mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH]
This commit is contained in:
parent
6042067c0b
commit
1459c8cc1d
6 changed files with 17 additions and 1 deletions
|
@ -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 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue