What Is Scaffolding In Ruby On Rails?

“Scaffolding is a temporary structure used to support a work crew to aid in the construction, maintenance and repair of buildings, bridges and all other man-made structures.” – Wikipedia

A scaffold is a set of automatically generated files wich forms the basic strucuture of a Rails Project

These files include


How to use the rails scaffold command

rails g scaffold books name:string description:string

If you generate your scaffolding like this, you’ll have 2 fields to work with.

A name and a description

That’s a bit more interesting than just having the database timestamps.

You can create individual components, like controllers, using the rails g (g for generate) command.

Examples: