On Oct 18, 6:17 am, Frederick Cheung <[email protected]> wrote: > On Oct 18, 12:39 am, 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. > > > 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 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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

