Rails: beware a column named ‘type’
1 June, 2012
Posted by on
It’s been said many times to not use the column name ‘type’, because rails uses this to define the subclass of a model that should be loaded. (great feature, by the way).
But if you have an existing database with a column called “type” and you want to interface to that database with active record, this is a great tip (thanks to this post):
class MyModel < ActiveRecord::Base
self.inheritance_column = "inheritance_type"
Ahh… back to work.