diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-07-27 17:27:47 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-07-27 17:27:47 +0100 |
commit | b658cf1198bbeb0fb702cd10c6f491cd90cedba0 (patch) | |
tree | e3163ecc180fd799659ab4d9579f91c5ff293f5a /activerecord/test/cases/associations/belongs_to_associations_test.rb | |
parent | 6a81ccd69d96f36f4322ef927191ab5a35e68d68 (diff) | |
download | rails-b658cf1198bbeb0fb702cd10c6f491cd90cedba0.tar.gz rails-b658cf1198bbeb0fb702cd10c6f491cd90cedba0.tar.bz2 rails-b658cf1198bbeb0fb702cd10c6f491cd90cedba0.zip |
Deprecate ActiveRecord::Base.scoped.
It doesn't serve much purpose now that ActiveRecord::Base.all returns a
Relation.
The code is moved to active_record_deprecated_finders.
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 76a2d0c00b..ec7e4f5fb7 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -73,14 +73,14 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase def test_eager_loading_with_primary_key Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") - citibank_result = Client.scoped(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key).first + citibank_result = Client.all.merge!(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key).first assert citibank_result.association_cache.key?(:firm_with_primary_key) end def test_eager_loading_with_primary_key_as_symbol Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") - citibank_result = Client.scoped(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key_symbols).first + citibank_result = Client.all.merge!(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key_symbols).first assert citibank_result.association_cache.key?(:firm_with_primary_key_symbols) end @@ -182,7 +182,7 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase def test_with_select assert_equal 1, Company.find(2).firm_with_select.attributes.size - assert_equal 1, Company.scoped(:includes => :firm_with_select ).find(2).firm_with_select.attributes.size + assert_equal 1, Company.all.merge!(:includes => :firm_with_select ).find(2).firm_with_select.attributes.size end def test_belongs_to_counter @@ -334,7 +334,7 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase def test_new_record_with_foreign_key_but_no_object c = Client.new("firm_id" => 1) # sometimes tests on Oracle fail if ORDER BY is not provided therefore add always :order with :first - assert_equal Firm.scoped(:order => "id").first, c.firm_with_basic_id + assert_equal Firm.all.merge!(:order => "id").first, c.firm_with_basic_id end def test_setting_foreign_key_after_nil_target_loaded @@ -396,7 +396,7 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase def test_association_assignment_sticks post = Post.first - author1, author2 = Author.scoped(:limit => 2).to_a + author1, author2 = Author.all.merge!(:limit => 2).to_a assert_not_nil author1 assert_not_nil author2 @@ -498,14 +498,14 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_nothing_raised do Account.find(@account.id).save! - Account.scoped(:includes => :firm).find(@account.id).save! + Account.all.merge!(:includes => :firm).find(@account.id).save! end @account.firm.delete assert_nothing_raised do Account.find(@account.id).save! - Account.scoped(:includes => :firm).find(@account.id).save! + Account.all.merge!(:includes => :firm).find(@account.id).save! end end |