Difference in generate scaffold files with different rails versions

I’ve found a difference in the files created by “./script/rails
generate scaffold Model xxx” with rails 2.3.14 and “./script/generate
scaffold Model xxx” with rails 3.0.10 that doesn’t make sense to me.
(both with ruby 1.8.7 on Gentoo Linux)

With 2.3.14, near the beginning of app/controllers/xxxes_controller.rb
is the line “@xxxes = Xxx.all” and a few lines later “format.xml
{ render :xml => @xxxes }” With 3.0.10, the first is “@xxx =
Xxx.all” and the second is has @xxx instead of @xxxes. All other
references to xxx or xxxes are the same in both versions. This causes
problems with 3.0.10, because app/views/xxxes/index.html.erb includes
the line “<% @xxxes.each do |xxx| %>” which causes a nil object error.

I’ve done plenty of searching, but haven’t found anything relevant.
Is this a bug, a feature, a side effect of misusing the scaffold
generator, …? Most if not all of the docs and tutorials I’ve found
are not specific about which version of rails they are base on.
Pointers to the right fine manual to read are also welcome, as I’m
still pretty new with both ruby and rails.

Thanks for any assistance.

On Oct 18, 12:39am, genterminl [email protected]
wrote:

I’ve found a difference in the files created by “./script/rails
generate scaffold Model xxx” with rails 2.3.14 and “./script/generate
scaffold Model xxx” with rails 3.0.10 that doesn’t make sense to me.
(both with ruby 1.8.7 on Gentoo Linux)

Is xxx what you are actually typing or just a placeholder? If it’s the
former, then the difference is probably the set of inflections rails
users to pluralize xxx, which i think has changed somewhere between
2.x and 3.x. With some words, you can get situations where taking a
word, pluralizing it and then singularizing it again doesn’t get you
the original word, which occasionally leads to trouble. I would expect
things to work properly with a word that was a more normal name for a
model.

Fred

On Oct 18, 6:17am, Frederick C. [email protected]
wrote:

2.x and 3.x. With some words, you can get situations where taking a

problems with 3.0.10, because app/views/xxxes/index.html.erb includes
the line “<% @xxxes.each do |xxx| %>” which causes a nil object error.

I have the same problem with xxx (done literally as a test) but also
“region” and “person.” However, in the “person” case, both versions
of app/views/people/index.html.erb have @people.each, but in app/
controllers/people_controller.rb the rails 2 version has @person =
person.all but the rails 3 version has @people = person.all. Both
versions have “people” elsewhere in the file - so it’s not just a
change in how it pluralizes, it’s a change in where it uses the plural
or not.

NOTE: I think my original message had it backwards. (It’s confusing
trying to keep two apps strait using different versions of rails…)
The rails 2 scaffold causes a problem with the mismatch, the rails 3
version is consistent, so it works.