This project is archived and is in readonly mode.
Throw a warning at generate scaffold and rake:db migration if fieldnames match rail's reserved words.
Reported by cake_joe | October 16th, 2010 @ 04:32 PM
Today I spend some hours figuring out why my enumeration to the field "type" did not save. Without validation the record would save and would silently ignore my type field. I thought I made an mistake on the dozens of setups you can have for enumerations / static array options.
Being a newbie: in the end I tried to do it via the Console, ran "r s" created a new object, setting some fields including objname.type = 'something' and save it. That worked... which I did not expect. Though on entering my scaffold index view it told:
"The single-table inheritance mechanism failed to locate the subclass: 'foo'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Component.inheritance_column to use another column for that information."
So I looked for reserved words and found this: http://juicebar.wordpress.com/2007/05/30/reserved-words-in-rails/
Comments and changes to this ticket
-
cake_joe October 16th, 2010 @ 04:34 PM
My suggestion is:
Throw a warning at generate scaffold and rake:db migration if fieldnames match rail's reserved words.Caveat: I am not so sure about migrations because they could work without ActiveRecord, and I do not know if the reserved words are specific to AR or ActiveModel.
-
cake_joe October 16th, 2010 @ 04:40 PM
- Tag changed from reserved words, enumeration, pola, scaffold, type, warnings to reserved words, enumeration, pola, rails3, scaffold, type, warnings
-
Santiago Pastorino February 2nd, 2011 @ 04:28 PM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:28 PM
- State changed from open to stale
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>