A scaffold in Rails is a full set of model, database migration for that model, controller to manipulate it, views to view and manipulate the data, and a test suite for each of the above.

To generate a scaffold for a blog use the rails generate command, short form 'g'.

rails g scaffold Post title body:text


The generator checks that there exist the directories for models, controllers, helpers, layouts, functional and unit tests, stylesheets, creates the views, controller, model and database migration for Post(creating the posts table and fields), takes care of the route for the resource, and new tests for everything.

Once it's generated your screen should look like this:

 You shold then run migrations so that the tables are created in the database.


To delete a scaffold use the rails destroy command


rails destroy scaffold Post