diff options
author | chapmajs <glitch@glitchwrks.com> | 2013-04-30 23:11:49 -0300 |
---|---|---|
committer | Takehiro Adachi <takehiro0740@gmail.com> | 2013-06-26 14:55:18 +0900 |
commit | 839efc5b6d754697682d5b2bd34ef28b2c5d2adf (patch) | |
tree | 9c714d14456c766dd3441e4ef66d14f419f4ac86 /activerecord/lib/active_record/model_schema.rb | |
parent | b23e0d66394a7c5442cc1ebbf4f1f2441878a8d2 (diff) | |
download | rails-839efc5b6d754697682d5b2bd34ef28b2c5d2adf.tar.gz rails-839efc5b6d754697682d5b2bd34ef28b2c5d2adf.tar.bz2 rails-839efc5b6d754697682d5b2bd34ef28b2c5d2adf.zip |
Allow global override of default STI inheritance column
This change fixes a bug by which 3.2-STABLE users can't globally override the default STI inheritance column with `ActiveRecord::Base.inheritance_column = 'some_column'`. 3.2-STABLE users are forced to use a deprecated method or monkey patch it otherwise.
Test case written by tkhr <takehiro0740@gmail.com>.
Diffstat (limited to 'activerecord/lib/active_record/model_schema.rb')
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index e10e6b4aa8..40cc8dcd69 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -159,7 +159,7 @@ module ActiveRecord # The name of the column containing the object's class when Single Table Inheritance is used def inheritance_column if self == Base - 'type' + (@inheritance_column ||= nil) || 'type' else (@inheritance_column ||= nil) || superclass.inheritance_column end |