method
inheritance_column
v1.2.6 -
Show latest stable
- Class:
ActiveRecord::Base
inheritance_column()public
Defines the column name for use with single table inheritance — can be set in subclasses like so: self.inheritance_column = "type_id"
2Notes
two ways to disable single table inheritance
- Don't use the column name 'type'
- Or if the first is no option for you: Tell Rails to look for a not existing column like:
==== class MyModel < ActiveRecord::Base # disable STI inheritance_column = :_type_disabled end
Disable STI
I had to add "self.inheritance_column" as opposed to simply "inheritance_column" to get this to work.
==== Code example
class MyModel < ActiveRecord::Base
# disable STI
self.inheritance_column = :_type_disabled
end