— Tagged with: , , — Written by

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():

class TypeTest < ActiveRecord::Base
  set_inheritance_column(:something_else)

  def type
    read_attribute(:type)
  end

  def type=(value)
    write_attribute(:type, value)
  end
end