This project is archived and is in readonly mode.
scaffold problem when using certain words
Reported by Takuya Okamoto | February 2nd, 2011 @ 02:49 PM
Hi,
I found a bug when using scaffold in Rails 3.0.3.
Example:
$ rails new rails3
$ cd rails3
rails3$ rails g scaffold stadium name:string
This command creates a file like the following...
rails3/app/views/stadia$ less new.html.erb
<h1>New stadium</h1>
<%= render 'form' %>
<%= link_to 'Back', stadias_path %>
link_to helper has "stadias_path". but I think, "stadia_path" is correct.
Please check it.
Comments and changes to this ticket
-
2kan February 7th, 2011 @ 10:41 PM
Takuya Okamoto, looks like you're right, gonna dig a bit more and assign a patch if you're correct.
-
2kan February 8th, 2011 @ 01:29 AM
- Tag set to rails edge, bug, generators, patch
- Assigned user set to Santiago Pastorino
Yes, there is a problem that pluralize of a 'stadia' is 'stadias' (really don't know is it correct in english or not), but we know that stadia is correct plural for stadium (but not very popular I think, isn't it?).
I've attached a patch (some test assigned for 'stadium') where I avoid calling pluralize on already pluralized words and singularize on already singularized for the table_name in the named_base.rb (see patch for more details).
-
Dan Pickett February 8th, 2011 @ 02:49 AM
statia or stadiums are the correct terms according to answers.com and dictionary.com
http://wiki.answers.com/Q/What_is_the_plural_of_the_word_stadium
http://dictionary.reference.com/browse/stadia2kan's approach is solid, but there is a deeper problem with the inflector. To avoid the problem in other places I added more omnipotent handling in the inflections so that "weird_string".pluralize.pluralize maintains the proper plural form.
I also added a test loop for all the double plural test cases
Otherwise
"oxen".pluralize.pluralize => "oxens" "media".pluralize.pluralize => "medias"
-
2kan February 8th, 2011 @ 03:25 AM
Dan, yes, that's great. I wasn't sure that I can fix it right in the inflector and not sure that there is no more such problems so I've decided just not to call them twice in generators.
-
2kan February 16th, 2011 @ 12:45 PM
This bug is reproduces for 3.0.4 and both patches fixes the issue.
-
2kan February 16th, 2011 @ 02:32 PM
Summary: This patches was done agains master and tested against master. Also I've applied them against 3.0.4 (this issue exists there) and tested (everything is ok). And I've applied them against 3.0-stable (this issue exists there) and tested (everything is ok).
-
Repository February 16th, 2011 @ 05:31 PM
- State changed from new to committed
(from [c6fac7b449ad88a623d99487d2731dddc6555636]) Fixed issue #6363, avoid to pluralized already pluralized names and singularize a single in generators, for example stadia is a valid plural for stadium. But calling pluralize for stadia will return stadias which sematically is not corrent in this case
[#6363 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/c6fac7b449ad88a623d99487d2731... -
Repository February 16th, 2011 @ 05:31 PM
(from [1754bd9b208e8d9207c226d1ffb3cee490856a78]) handle double pluralization for irregular plurals
[#6363]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/1754bd9b208e8d9207c226d1ffb3c... -
Repository February 16th, 2011 @ 05:32 PM
(from [e925acb8269037354269456c5b89260725abf566]) handle double pluralization for irregular plurals
[#6363]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/e925acb8269037354269456c5b892... -
Repository February 16th, 2011 @ 05:32 PM
(from [149c3d687aba7093c925d8824c610e3639f976bd]) Fixed issue #6363, avoid to pluralized already pluralized names and singularize a single in generators, for example stadia is a valid plural for stadium. But calling pluralize for stadia will return stadias which sematically is not corrent in this case
[#6363 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/149c3d687aba7093c925d8824c610...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 6363 scaffold problem when using certain words (from [c6fac7b449ad88a623d99487d2731dddc6555636]) Fixed i...
- 6363 scaffold problem when using certain words [#6363 state:committed]
- 6363 scaffold problem when using certain words [#6363]
- 6363 scaffold problem when using certain words [#6363]
- 6363 scaffold problem when using certain words (from [149c3d687aba7093c925d8824c610e3639f976bd]) Fixed i...
- 6363 scaffold problem when using certain words [#6363 state:committed]