Sunday, November 9, 2008

Don't use column name type

I had a table and there was a business need to add a type column in the table. Adding a type column as an integer or as an string didn't work.
"type" is a reserved field name for single table inheritance (STI). Active Record allows inheritance by storing the name of the class in a column that by default is called “type”

Here are the magic field names in Rails:
http://wiki.rubyonrails.com/rails/pages/MagicFieldNames

0 comments: