September 21st, 2007
ActiveRecord: Using the "type"-column
By default it’s not possible to use a database-column called “type” for anything else than single table inheritance. To change this, simply use set_inheritance_column() and read_attribute():
1 class TypeTest < ActiveRecord::Base 2 set_inheritance_column(:something_else) 3 4 def type() 5 read_attribute(:type) 6 end 7 8 def type=(value) 9 write_attribute(:type, value) 10 end 11 end
