A public service announcement: Since the release of 2.0, there have been numerous questions on the list regarding scaffolding. I attribute this to two factors:
- Almost every tutorial uses scaffolding for up-and-running kind of instant gratification
- There are some cases where scaffolded CRUD is adequate and devs can focus on more important issues
As of 2.0.x, scaffolding is extracted to a plugin. Moreover, “classic pagination,” on which scaffolding depends has also been extracted. So, to get any measure of the 1.x dynamic scaffolding behavior, you have to install the two plugins.
It may seem like you’re just hunky-dory with scaffolding if you do a:
script/generate scaffold person
but that’s not quite what you might expect. Yeah, it works, but your people index action produces a list that is not paginated. That’s a behavior shift from the 1.x scaffold that utilized pagination.
Ok, to the point of this post. Rails Core has driven a stake in the ground by extracting scaffolding. My interpretation is that they don’t expect to enhance scaffolding, but would prefer to leave it to people who like/use scaffolding.
I don’t use scaffolds at all, but have sympathy for anyone getting into Rails who runs square into a brick wall right at the start of their “introduction to Rails” tutorial. Thus, I have these recommendations:
- Use Rails 1.x to work through the tutorials if that’s an option. If you don’t none of the automatically generated code will look remotely similar to the 2.x stuff. -or-
- Read the tutorials about the scaffolding but don’t type in any of the code because it’s likely not to work in 2.x, then take the concepts you learn from your quiet-time reading and apply them to a 2.x project. -or-
- Repeat the previous step and then look into something like the ActiveScaffold plugin (http://activescaffold.com/). Again, the code will not look like what’s in your tutorials, but at least ActiveScaffold hasn’t been pushed off into the weeds. -or-
- (Not recommended) Use Rails 2.x, and install the scaffolding plugin (script/plugin installhttp://dev.rubyonrails.org/browser/plugins/scaffolding)) and the classic pagination plugin (script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination).
So many choices, so little time. What to do? I suggest reading quietly, then blundering around with 2.x until you feel comfortable that you’ve gotten a “hello, world” working without the safety net of scaffolding.
I hope this helps.