Scaffolding is nothing magical: it’s just a time-saving way to generate
a bunch of files and boilerplate code you typically need when initially
building an application or adding major new sections to one.
You’ll most likely find yourself generating a scaffold for one or two
central models (maybe your main public model and controller and your
main admin controller), and from there you’ll create a bunch of extra
views by hand or copy-and-paste and often just do a “generate model”
when you create secondary tables and classes. “generate scaffold” will
generally just come into play when a new table you create needs its own
You can create all these files by hand, but matching filenames to the
CamelCase class names is a hassle when you’re doing more than one at a
time, and if you want all the scaffold actions and views it’ll usually
be easier to generate and edit than to copy and paste and try to get the
class name right in a dozen places. When you need a new model, helper
and CRUD controller and views all at once, a generate is usually going
to make more sense than doing it by hand. On the other hand, sometimes
you’ll just need one new file, like a model for a non-database class,
and you’ll create it by hand.
Work the way it makes sense to you, and over time you’ll get a feel for
when you want to generate a full scaffold, just generate a model or
controller, or create a file by hand.
Josh K. wrote:
there are some things on a scaffold that i would like to use without the
whole thing. is it better to generate one and then cut it down to only
what you’ll use?
are all of the things in a scaffold available to just build by hand? for
instance, i have a scaffold for my users. in the list action, it has
@user_pages, so that you can put @user_pages.current.next or something
like that - is that something i can do with any of my model
automatically just by having @model_pages in the action?