mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added additional comments on how to use the "type" column without
single-table inheritance by overriding it in your ActiveRecord Model.
This commit is contained in:
parent
9f5d2b1202
commit
110bfbc5e3
1 changed files with 11 additions and 1 deletions
|
@ -103,9 +103,19 @@ module ActiveRecord
|
|||
def abstract_class?
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
# Defines the name of the table column which will store the class name on single-table
|
||||
# inheritance situations.
|
||||
#
|
||||
# The default inheritance column name is +type+, which means it's a
|
||||
# reserved word inside Active Record. To be able to use single-table
|
||||
# inheritance with another column name, or to use the column +type+ in
|
||||
# your own model for something else, you can override this method to
|
||||
# return a different name:
|
||||
#
|
||||
# def self.inheritance_column
|
||||
# 'zoink'
|
||||
# end
|
||||
def inheritance_column
|
||||
'type'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue