From 839efc5b6d754697682d5b2bd34ef28b2c5d2adf Mon Sep 17 00:00:00 2001 From: chapmajs Date: Tue, 30 Apr 2013 23:11:49 -0300 Subject: 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 . --- activerecord/lib/active_record/model_schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/model_schema.rb') 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 -- cgit v1.2.3