diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2010-01-03 19:30:28 -0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2010-01-03 19:30:28 -0800 |
commit | 1459c8cc1d6baca324bf2350d8f89f4faa054f18 (patch) | |
tree | 0b50bb958fc400773e41cfa3fea42624dfcb0cc8 | |
parent | 6042067c0b20602e72954450e9e8a19dfa8a9f7d (diff) | |
download | rails-1459c8cc1d6baca324bf2350d8f89f4faa054f18.tar.gz rails-1459c8cc1d6baca324bf2350d8f89f4faa054f18.tar.bz2 rails-1459c8cc1d6baca324bf2350d8f89f4faa054f18.zip |
Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH]
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 | ||||
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/inheritance_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/modules_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/reflection_test.rb | 4 |
6 files changed, 17 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 4846774deb..fc6f61f121 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *Edge* +* Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH] + * Add Relation#delete_all. [Pratik Naik] Item.where(:colour => 'red').delete_all diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 7cefba2b82..78b92be849 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -550,7 +550,7 @@ module ActiveRecord #:nodoc: # Determine whether to store the full constant name including namespace when using STI superclass_delegating_accessor :store_full_sti_class - self.store_full_sti_class = false + self.store_full_sti_class = true # Stores the default scope for the class class_inheritable_accessor :default_scoping, :instance_writer => false diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 730d9d8df7..47e7a4bb79 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -2138,8 +2138,11 @@ class BasicsTest < ActiveRecord::TestCase end def test_type_name_with_module_should_handle_beginning + ActiveRecord::Base.store_full_sti_class = false assert_equal 'ActiveRecord::Person', ActiveRecord::Base.send(:type_name_with_module, 'Person') assert_equal '::Person', ActiveRecord::Base.send(:type_name_with_module, '::Person') + ensure + ActiveRecord::Base.store_full_sti_class = true end def test_to_param_should_return_string diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 73e51fbd91..0672fb938b 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -241,6 +241,7 @@ class InheritanceComputeTypeTest < ActiveRecord::TestCase end def test_instantiation_doesnt_try_to_require_corresponding_file + ActiveRecord::Base.store_full_sti_class = false foo = Firm.find(:first).clone foo.ruby_type = foo.type = 'FirmOnTheFly' foo.save! @@ -259,5 +260,7 @@ class InheritanceComputeTypeTest < ActiveRecord::TestCase # And instantiate will find the existing constant rather than trying # to require firm_on_the_fly. assert_nothing_raised { assert_kind_of Firm::FirmOnTheFly, Firm.find(foo.id) } + ensure + ActiveRecord::Base.store_full_sti_class = true end end diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb index 4f559bcaa5..d781a229f4 100644 --- a/activerecord/test/cases/modules_test.rb +++ b/activerecord/test/cases/modules_test.rb @@ -12,6 +12,8 @@ class ModulesTest < ActiveRecord::TestCase [:Firm, :Client].each do |const| @undefined_consts.merge! const => Object.send(:remove_const, const) if Object.const_defined?(const) end + + ActiveRecord::Base.store_full_sti_class = false end def teardown @@ -19,6 +21,8 @@ class ModulesTest < ActiveRecord::TestCase @undefined_consts.each do |constant, value| Object.send :const_set, constant, value unless value.nil? end + + ActiveRecord::Base.store_full_sti_class = true end def test_module_spanning_associations diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index acd214eb5a..211cf1d449 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -137,6 +137,8 @@ class ReflectionTest < ActiveRecord::TestCase end def test_association_reflection_in_modules + ActiveRecord::Base.store_full_sti_class = false + assert_reflection MyApplication::Business::Firm, :clients_of_firm, :klass => MyApplication::Business::Client, @@ -172,6 +174,8 @@ class ReflectionTest < ActiveRecord::TestCase :klass => MyApplication::Billing::Nested::Firm, :class_name => 'Nested::Firm', :table_name => 'companies' + ensure + ActiveRecord::Base.store_full_sti_class = true end def test_reflection_of_all_associations |