Nicely done! You can now update a destination’s name and description. How does it work?
When you visit
http://localhost:8000/destinations/1/edit to edit a destination, it triggers the first turn of the request/response cycle:
editaction finds the destination with id 1, stores it in
@destination, and passes it on to the view app/views/destinations/edit.html.erb.
form_forcreates a form with the fields of the
Then when you fill out the form and submit it, it triggers the second turn of the request/response cycle:
destination_paramsmethod to safely collect data from the form. It finds the destination in the database, updates its attributes, and redirects to the destination’s
Click Next to continue.