Permalink
Browse files

Changed ActiveRecord::Base.store_full_sti_class to be true by default…

… reflecting the previously announced Rails 3 default [DHH]
  • Loading branch information...
1 parent 6042067 commit 1459c8cc1d6baca324bf2350d8f89f4faa054f18 @dhh dhh committed Jan 4, 2010
View
@@ -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
@@ -550,7 +550,7 @@ def self.reset_subclasses #: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
@@ -2138,8 +2138,11 @@ def test_to_xml_with_block
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
@@ -241,6 +241,7 @@ def teardown
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 @@ def test_instantiation_doesnt_try_to_require_corresponding_file
# 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
@@ -12,13 +12,17 @@ def setup
[: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
# reinstate the constants that we undefined in the setup
@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
@@ -137,6 +137,8 @@ def test_belongs_to_inferred_foreign_key_from_assoc_name
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 @@ def test_association_reflection_in_modules
: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

0 comments on commit 1459c8c

Please sign in to comment.