- Build a working
create
action - Use a
form_tag
to create a new form that submits to theindex
action - Correctly name form fields so that they end up at the top level of the
params
hash - Assign data from
params
to aStudent
object in thecreate
action - Save that
Student
object in thecreate
action - Create a
redirect_to
from thecreate
action to theshow
action
Many of the spec tests are already passing for this lab, but there are some additional ones –– including our first use of controller tests –– located here:
-
Controller Specs -
specs/controllers/students_controller_spec.rb
-
Capybara Specs -
specs/features/student_spec.rb:37
When this lab is complete, your application should have the following behavior:
-
User fills out the form on
students/new
-
When the form is submitted, a new record is created in the database
-
After the user submits the form, they are redirected to the
show
page that renders theStudent
record that they created
Make sure to use a route helper method to redirect to the show
page at the end of the create
method. You can find the correct syntax for this route by running rake routes
in the terminal.