Create Idea scaffold

We're going to use Rails' scaffold functionality to generate a starting point that allows us to list, add, remove, edit, and view things; in our case ideas.

Coach: What is Rails scaffolding? (Explain the command, the model name and related database table, naming conventions, attributes and types, etc.) What are migrations and why do you need them? What is MVC?

rails generate scaffold idea name:string description:text picture:string

The scaffold creates new files in your project directory, but to get it to work properly we need to run a couple of other commands to update our database and restart the server.

rake db:migrate
rails server

Open http://localhost:3000/ideas in your browser. Click around and test what you got by running these few command-line commands.

* If you encounter an "ExecJS runtime error" on Windows, then you should download node.js and that might fix the problem. If the problem is still not solved, this might help.

This is the ideas table. It's still empty because we didn't create any ideas:

Click on "New Idea" link to get to the "New idea" page that looksl like this:

You'll be able to fill in the information of your idea like this:

After clicking on the "Create Idea" button you'll be forwarded to the idea page, which contains the information you just filled in. At the top of the page you'll see a green notification stating that the creation of the idea was successful.

Click "Back" to return to the list of ideas and see that it now contains the idea you just created:

And that's it! Add some more ideas and then continue to review the code.

continue