Question 3 in 1 :)
1st answer
As others have said, you need to modify the table to have new fields, and this can be easily done with migration :
rails generate migration AddAuthorToPost author:string
But you also need to change your views, because it will not contain a new field. The corresponding views are in app/views/posts (find edit.html.erb and new.html.erb ).
Of course you need to migrate to your database:
rake db:migrate
Second answer
You can add your style sheets to your views in app/views/posts , but I recommend that you use layouts for your application, layouts are located in app/views/layouts . You can simply create application.html.erb in your layouts directory and include your CSS there.
<html> <head> <%= stylesheet_link_tag "custom" %> </head> <body> <%= yield %> </body> </html>
The yield block will contain the actual output of your views, so you must remove these parts from existing views.
Third answer
If you want to control the accepted characters for a specific field, you can do this in validation in your model.
validates :title, :format => { :with => /\A[a-zA-Z]+\z/, :message => "Only letters allowed" }, :length => { :maximum => 20 }
source share