aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-09-12 09:29:10 -0700
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-09-12 09:29:10 -0700
commit079eed83d9822959a0a4efacc31e912165024a26 (patch)
tree0e1f42f2658e943950675f66a9cd62483acf46c0
parent9a818664702695676096f2812a61af94eaa2ab8f (diff)
parent110bfbc5e3d8931daca7f73bb6bb143d77180f36 (diff)
downloadrails-079eed83d9822959a0a4efacc31e912165024a26.tar.gz
rails-079eed83d9822959a0a4efacc31e912165024a26.tar.bz2
rails-079eed83d9822959a0a4efacc31e912165024a26.zip
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]
-rw-r--r--activerecord/lib/active_record/model.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/model.rb b/activerecord/lib/active_record/model.rb
index 57553c29eb..44cde49bd5 100644
--- a/activerecord/lib/active_record/model.rb
+++ b/activerecord/lib/active_record/model.rb
@@ -101,9 +101,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