Is the rails 2.0 scaffold system philosophically ( not technically? ) broken?


I've read the (many) re-posts about problems around scaffolding in
Rails 2.0 and have followed a number of tutorials and fully understand
"how to scaffold" from a technical perspective, but I don't
understand the *mindset* of how to use the new scaffolding. It seems
like a productivity- / agility- regress and I'm thinking I may have
failed to properly grok the new setup. In the interest of full
disclosure, I'm coming back to Rails after being in other toolkits for
about 9 months.

Thanks to the intrepid work of Sean Lynch at (
) I found a tutorial that would familiarize me with the raw "how to
scaffold" material.

I followed his tutorial's step of:

``ruby script/generate scaffold Movie''

Great! From that point I filled in the "columns" in the migration as I
had done in Rails 1.x. All I should need to do is run ``rake
db:migrate'' and try adding a new record via the dynamically-created

When I started the server and navigated localhost:3000/movies I had
the "create new" button. When I pushed that button there were no text
widgets to enter *despite having defined the columns that corresponded
to said widgets* having been added to the migration ( I have a lengthy
blog post about how my diagnostics went, for anyone else's edification
at ). In short the scaffold that had
been created knew nothing of the columns I had added in the migration
and, as such, the 'new' view had no widgets.

This struck me as well, wrong. On Sean's post another user confirms
the same experience. I have tried it with sqlite3 / mysql / postgres

Research showed that the scaffold had remained static relative to the
time that I had done the original aenemic invocation. Per ``script/
generate scaffold --help'':

./script/generate scaffold post` # no attributes, view will be anemic

To fix this I had to re-issue the script/generate command with all the
attributes in "final draft" mode ( ``script/generate scaffold movie
title:string text:description one_sheet_url:string'' ) and then over-
write the old templates ( output stored below, for legibility, Fig.

The solution implies:
- You have to get the script/generate command's "attributes"
arguments *perfect* at time of creation OR
- You do this overwriting thing that I describe below.

As I recall Rails 1.x's dynamic scaffolding allowed us to use a
scaffold flexibly strictly based on migrations and rake db:migrate.
This flexibility allowed us to "sketch" ideas very rapidly. Or is it
considered a "Good Thing" that you get a "perfected" ``generate
scaffold'' command at some point? If so, what's the reasoning? Am I
missing some sort of rake command that "refreshes" the scaffold

Based on the comments at Sean's site and some of the questions in the
comments to DHH's Rails 2. announcement I think there are others
grappling with this quandry as well. Can anyone help?


==Fig. 1==
bash-3.2$ script/generate scaffold movie title:string text:description
      exists app/models/
      exists app/controllers/
      exists app/helpers/
      exists app/views/movies
      exists app/views/layouts/
      exists test/functional/
      exists test/unit/
overwrite app/views/movies/index.html.erb? (enter "h" for help)
[Ynaqdh] y
       force app/views/movies/index.html.erb
overwrite app/views/movies/show.html.erb? (enter "h" for help)
[Ynaqdh] y
       force app/views/movies/show.html.erb
overwrite app/views/movies/new.html.erb? (enter "h" for help) [Ynaqdh]
       force app/views/movies/new.html.erb
overwrite app/views/movies/edit.html.erb? (enter "h" for help)
[Ynaqdh] y
       force app/views/movies/edit.html.erb
   identical app/views/layouts/movies.html.erb
   identical public/stylesheets/scaffold.css
  dependency model
      exists app/models/
      exists test/unit/
      exists test/fixtures/
   identical app/models/movie.rb
   identical test/unit/movie_test.rb
        skip test/fixtures/movies.yml
      exists db/migrate
Another migration is already named create_movies: db/migrate/

Scaffolds != Rails

They're a starting point, and as such just give you something to start
with. Scaffolds aren't meant to be your whole application, so the
code is treated just like code that's written independent of them: If
your object model changes, then you need to change your views and
controller logic to match.


So your take could be summarized as: "The scaffold system is as good
as it needs to be because you're only going to use it really briefly
before you start fleshing out proper views".

Jeremy McAnally wrote:

Scaffolds != Rails

No, but the simplicity of the Rails 1.x scaffold is what 'sold' Rails to
a lot of people (e.g. via the famous DHH Blog app video on the Rails
site). Personally, I think it would have been nice to have kept the
'backwards compatibility' intact so that newcomers would have ready
access to all the Rails 1.0 tutorials available rather than trying to
follow those tutorials and immediately running up against the buffers,
so to speak... :wink:

best wishes
Ruby In Steel for Visual Studio

I believe you can still install it from a plugin if you're really
interested in it.

I think dynamic scaffolding was a crutch that kept people from really
getting Rails from the start (i.e., you didn't have to build views so
they were missing out on that). I think making them generate the code
gets them elbow deep in the sort of stuff they'll be writing quicker.


Breaking backward compatibility is a luxury that only open-source
developers can afford. It costs nothing to lose customers if they
aren't paying. If you need to maintain your customer base (like, for
example, Microsoft does) then you do anything to avoid breaking
backward compatibility.

See for example:

I personally was quite shocked to see that Rails 2 knowingly broke
things. Extracting to a plugin I can deal with. Outright removal is


Even though this is a bit off-topic, Rails didn't arbitrarily break
things. Developers who use Rails use the code: it's exposed, we
manipulate it, and it's what we use in our applications. Therefore,
it's in the best interest of everyone involved if Rails cuts out the
cruft while pushing towards better solutions. If someone wants to
keep using old feature, they're welcome to keep using the version of
Rails they're using.

I would hate to end up with a 35MB framework that could easily be 2MB
or less but has kept so much stuff around in the interest of backwards


Um, this looks interesting:


Fortunately, open-source projects are not run by money. They respect their users, and that's why there's a cycle of deprecation/removal going on. Warnings about deprecated stuff all over the place, documentation, etc.

A major release is allowed to break things, that's what the 2.0 signals. You can put the version of Rails your application is known to run OK under vendor/rails, or revise and upgrade.

To polish and continue improving something you need to add, but you need to cut as well. A major release allows cutting.

-- fxn

And there's no one holding a gun to anyone's head forcing them to use
the new versions. You can wait until you are ready, the old versions
are still there.

Applications using frameworks like Rails are tied to the
implementation of the version of the framework they use. This is okay
as long as you can control if and when you move to a new version.
Some years ago, there was a lot of interest in the idea of making
framework-based operating systems. Here's a war story from those

Breaking backward compatibility is a luxury that only open-source
developers can afford.

Backwards compatibility is frequently very expensive. Microsoft in
particular expends vast amounts of resources on backwards
compatibility, and quite a bit of that effort is almost entirely
useless to the vast majority of their customers.

Would you rather have those engineers working on new/improved
functionality, or on bug-for-bug compatibility that's only interesting
to a tiny minority of users?

Think of backwards compatibility as a tax that older users impose on
newer users. That may be worth paying; newer users may themselves
want backwards compatibility in the future.

But the community may also decide that tax isn't worth paying. Older
users may be required to spend resources to use newer versions of the
system in question. That's OK; they're getting the benefits of
development resources applied to the newer versions too.

If you need to maintain your customer base (like, for
example, Microsoft does) then you do anything to avoid breaking
backward compatibility.

Not at all. Older users just have to spend some resources making sure
they're good on the newer system. It's one of those
engineering/business decisions that people make every day.

Philosophical arguments aside, if they were going to take it out, they
should have, well, just taken the whole thing out. I should just get an
error when I try to create a scaffold if it isn't going to get made

All this about backward compatibility is all fine and good; but at the
very least i should get a deprec message instead of having to hunt
through the erb files in the vestigial scaffold remnants that don't
work, re-rake, see that nothing changed, question my own sanity, then do
a Google search and come here. It doesn't make sense.

All this about backward compatibility is all fine and good; but at the
very least i should get a deprec message instead of having to hunt
through the erb files in the vestigial scaffold remnants that don't
work, re-rake, see that nothing changed, question my own sanity, then do
a Google search and come here. It doesn't make sense.

I suggest to delegate the scaffolding to a plugin which specializes
with this task, for instance

(yeah that doesn't answer the philosophical question for sure!)

best wishes !

Thibaut Barrère / LoGeek

Many older tutorials (and books) suggested a method of working models
and relations like:
generate model, scaffold, migrate, check, migrate, check... (e.g. the
original blog-video and the depot tutorial)

That is all deprecated and replaced by... what?
How will the rewrites look?
What is the new preferred way of working?

I was quite comfortable with this way of working myself and I haven't
really found something to fill the void yet.
I don't want to sound critical. I would just love to get the scoop on
what has made scaffolding more or less obsolete in the eyes of the
core team.

My current guess is that I should start using the console more when
being interactive with models.

Martin Westn

Dynamic scaffolds give you squat. You got one line of code doing some
magical things so your browser renders some magical other things - don't
tell me you can learn the framework by staring at that line long enough
until it conveys meaning. It won't.

There's a place for it of course: marketing material. Shiny "oh look
this is so great" screencasts, which imply that your next big Web2.0
Buzzword-Compliant Social Networking app is just ten minutes away.

What you can do is script/generate scaffold Foo bar:text - that'll give
you stuff to look at, and if you don't like what you see you actually
have the chance to change stuff. Also, it does what the name implies
("scaffold", remember?), which is A Good Thing.

In other news, the "preferred way of working" is still, after all those
years, to actually writing code while knowing wtf is going on.

Oh, and another reason: everytime someone writes scaffold into their
text editor or irc client, god kills a kitten. true story.

Martin wrote:

Sooooo....I'm guessing there's no more code generation huh?

These sorts of decisions usually make tons of sense to core developers
on a framework. However, to the masses, it may be a quite different.

Here is a newbie's perspective:
I've been into web frameworks for about a year now. And the "magic" of
code generation is what drew me in. CakePHP has a "bake" feature,
which doesn't do a 1/4 of the stuff I've seen RoR do in the 12 hours
I've been messing with it. I stayed a way from RoR this long for the
simple fact that I didn't see the need tl learn Ruby, due to it's
"interesting" syntax.

Recently I saw a screen cast of the RadRails plugin and I was sold on
RoR. Along with the fact that it's more established and has a larger
following. From all the tutorials I've been reading the code
generation was light years ahead of CakePHP. So I'm thinking, I'll
install this guy, install that cool IDE, and get going with the Agive
Web Dev. Book and a few tutorials. I figured the quickest way to get
into RoR is to port some of my CakePHP apps: import that databases
(schema conventions seem to mimic RoR), slap on some scaffolding to
generate my MVC's, then peer into the code. There are sooooo many
plugins there, I couldn't wait to get started on more complicated
things like AJAX, Auth, etc.

12 hours later, I'm still trying to scaffold that stupid cookbook2
with two tables in it. I thought I was doing something wrong. I
figured, it already got the schema of the database, how hard could it
be to build the stupid models, controllers and views. To my great
dismay, I've come to learn they have been removed? Wow.

Sorry for the rant, but I don't really understand. What's the point of
all the visual database design tools, if at the end of the day, I
still gotta write everything in the migration syntax? I see where all
the migration stuff can come in handy for "revisions", but when
starting off, I don't get it. Yes, scaffolding will give you a lot
more stuff than you need. But, IMO, it's much easier to sit on the
delete key for a while, than it is to go write code that you don't

Can someone please tell me that I'm mistaken. And that there HAS to be
a way around this? How do I get tons of SQL into an "initial"
migration, so that I can generate MVC's from there?

ThanX in advance.

I guess the Rails core team has become a little out of touch with the
newbie developer. But, frankly, that's a necessary step for the
maturation of a project like this. 3 years ago, Rails needed all the
mindshare it could get, and the infamous screencast was a powerful
hook to draw people in.

These days things are different. The core team is trying to Rails as
powerful as possible for it's large userbase without bloat. So far
the vision has been maintained extremely well. Maybe the decisions
with scaffolding don't sit well with everyone. The problem is when
debate happens in the core community, scaffolding is the last thing on
everyone's list to worry about.

I really sympathize with the effect of undocumented changes and out of
date tutorials--I've been burned plenty. But scaffolding really is
such an insignificant part of Rails that its flaws should have no
bearing on your decision of whether or not to use Rails. Rails isn't
a visual toolkit, it's a serious development framework. You just have
to make it over two humps in the learning curve: the Rails API hump
and then later the Dynamic Ruby hump and you'll be golden.

Hi Everyone,

I've read each post in this thread & I cannot believe the
misunderstanding of 'scaffold' in rails 2.0.2

As Johannes puts it so well...


Dynamic scaffolds give you squat. You got one line of code doing some
magical things so your browser renders some magical other things -
tell me you can learn the framework by staring at that line long
until it conveys meaning. It won't.
<<<<<<<< End Quote

Can I suggest those who are complaining about this change follow
"Akita's" tutorial on rails 2, which should enlighten you to what the
change is all about in a real context !

HTH - Dave Porter

Maybe the use of the term scaffolding is wrong. I meant the code generation from the migration.

Everyone here is always going to say that it’s not hard to write your own controllers. I’m not saying it’s hard. I’m saying, as a newbie developer in the framework, it’s a great helping tool. For me, web development is about getting stuff done.

But seriously, how does one “import” and already existing database design into a Rails Project? I’m talking about 100+ tables, with (on average) 20+ fields.

Does one need to specify script/generate model (and all 20 fields)?

This is the first time I have been unpleasantly surprised by a comment
on this forum. I wonder if this reflects the views of the core team.

Working on creating 2 large apps based on rails 1, I am in the process
of moving them to Rails 2. But I sense a significant distance between
the core Rails Movers and "the Rest of us". So much of the
documentation (which was in any case not ideal) has now been confused,
and left behind. As an existing Rails developer, I can just about
cope with the transition of how to convert to plugins for things like
pagination, auto_complete etc. (But for a good summary of the changes
I was forced to buy the peepcode pdf) I dont mind paying , but I
would if I was just trying rails out for the first time . So many of
the tutorials are now going to just not work for Rails 2 and are going
to point in the wrong direction, particularly as regards REST (and
consequently the scaffold) and routing which is getting a fairly high
profile. Even the Agile Rails book is no longer being quoted as the
Primary resource. I suspect if I were coming as a noob, then this
amount of confusion, on top of the lack of a single documentation
resource, would cause me to give up in disgust.

Now I do not want to be a complainer. I do not have any problems with
the Rails 2 direction, and getting to grips with REST routing and the
various concepts is really good for me. But if there is no leg up for
those entering the fray for the first time,and it is felt that
maturing the product necessitates losing touch with the noob, there
is a danger that Rails could become an old boy's club. (Purely my own
opinion, but that would be a real shame - I have been a strong
advocate of Rails.)

Being a transition from 1 to 2, means this is Rails first experience
in version transition. The rails team has got so much right that it
would be a shame to dismiss the significance of the version
transition. I think there is merit in the view that need for total
backward compatibility can be dispensed with. But if that is done
without clear documentation for the transition and its implications
(prominantly on the Rails home site - cos that is the logical first
place to look), then it is just going to leave confusion to eventually
do its worst.

comments made with good intentions - reflecting my own feelings along
the way.