To Examples
GuestBook Directions
Create a new rails project named GuestBook.
Navigate to the GuestBook folder.
Generate a model named Comment with these fields:
Field
Datatype
name
string
message
text
Enter this rake statement to create the database:
rake db:migrate
Generate a controller with name Comments with views new and display_all.
Use this code for the controller
comments_controller.rb
.
Use this code for the views
new.html.erb
and
display_all.html.erb
.
Add a post route to the config/routes.rb file:
post "/comments/display_all"
Add a layout page and a CSS style file.
View the display_orders view in a browser at this URL:
http://localhost:3000/comments/display_all