Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #7605 from revans/master

Add docs to inheritance_column method, explaining how to override it
to be able to use the "type" column without STI [ci skip]
  • Loading branch information...
commit 079eed83d9822959a0a4efacc31e912165024a26 2 parents 9a81866 + 110bfbc
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 activerecord/lib/active_record/model.rb
View
12 activerecord/lib/active_record/model.rb
@@ -101,9 +101,19 @@ def arel_engine
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
Please sign in to comment.
Something went wrong with that request. Please try again.