Review the code

The scaffold command automatically created many code files in your project’s folder. These files are responsible for creating the pages we just saw. Let’s review some of them.

Folder/file name Role
db/migrate/XXXXX_create_ideas.rb This file is called "the migration file". It contains instructions in the Ruby language that tells your Rails app how to change the database so that it is able to contain the ideas you created.
app/models/idea.rb The Idea model.
app/controllers/ideas_controller.rb The idea controller contains the logic behind all the actions we saw: reading the list of ideas from the database for the list page; reading a single idea for the show page; creating a new idea; editing an existing idea and deleting an idea.
app/views/ideas This folder contains all the HTML files that were created. The following 5 files are all contained in this folder.
index.html.erb The HTML of the ideas list.
edit.html.erb The HTML of the edit idea page.
show.html.erb The HTML of the idea page.
new.html.erb The HTML of the new idea page.
_form.html.erb The HTML of the idea form. The edit and new page both use this file to display a form.

Coach: Explain the code in some or all of these files. It is recommended to give this explanation to all the participants in your group together.