This project is archived and is in readonly mode.
Scaffolding with name that ends in "ie" does not create or edit correctly.
Reported by chrisopeterson | September 10th, 2010 @ 12:40 AM | in 3.x
I ran across this problem by using straight out of the box scaffolding.
rails generate scaffold Lie title:string etc...
This will produce the correct scaffolding but any attempts to create or edit Lie objects results in Null database inserts. This is all again, with straight out of the box scaffolding.
SQL (0.5ms) INSERT INTO "lies" ("created_at", "description",
"title", "updated_at", "source", "video") VALUES ('2010-09-09
21:45:29.951629', NULL, NULL, '2010-09-09 21:45:29.951629', NULL,
NULL)
Redirected to http://localhost:3000/lies/1
Completed 302 Found in 72ms
I tried the same thing with other scaffold names in different rails 3.0 environments and still get the same error. I think it has something to do with the way rails generates the scaffolding names and creates the object @ly throughout the code instead of @lie.
You can get the same problem with any other word that ends in
"ie" Calorie for example.
rails generate scaffold Calorie does not work either.
Comments and changes to this ticket
-
Neeraj Singh September 10th, 2010 @ 01:08 AM
- Importance changed from to Low
I am able to create
rails g scaffold Calorie name:string type:string
And then I am able to hit both
http://localhost:3000/calories
http://localhost:3000/calories/1
I am using rails edge.
-
chrisopeterson September 10th, 2010 @ 03:39 AM
I can create the scaffolding fine.
Creating and editing records with the scaffold only inserts null values. I have gotten the same results in different dev environments.
Ruby 1.8.7 - Rails 3.0.0
-
Neeraj Singh September 10th, 2010 @ 10:47 AM
- Milestone set to 3.x
- State changed from new to open
-
Neeraj Singh September 10th, 2010 @ 11:18 AM
- Assigned user set to Neeraj Singh
-
Tim Shaffer September 10th, 2010 @ 01:06 PM
I just ran into this same problem. I was able to work around it by adding an inflection:
inflect.irregular 'Lie', 'Lies'
-
Rohit Arondekar September 10th, 2010 @ 01:17 PM
The inflector is used to determine the table names. But the inflector isn't perfect. This certainly looks like one of those cases where the inflector doesn't know how to get the plural. In such cases you need to add an inflection in the config/initializers/inflections.rb as mentioned above.
-
Neeraj Singh September 10th, 2010 @ 01:34 PM
- State changed from open to resolved
As others have pointed out adding following line solves the problem.
ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'Calory', 'Calories' end
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>