diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-04-27 11:42:22 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-04-27 11:42:50 +0100 |
commit | df6f971e3aedf8bb1ec318de95d7ce849e2c9c9e (patch) | |
tree | c18946036ddff7f38c92a9c4f8bff99bc6da49c9 /activerecord/test/cases/associations/belongs_to_associations_test.rb | |
parent | a57b7842d0fcdcbcc567532d3a5c1f2628057a0d (diff) | |
download | rails-df6f971e3aedf8bb1ec318de95d7ce849e2c9c9e.tar.gz rails-df6f971e3aedf8bb1ec318de95d7ce849e2c9c9e.tar.bz2 rails-df6f971e3aedf8bb1ec318de95d7ce849e2c9c9e.zip |
%s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other things
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 0dd6b798d3..65a353fdaf 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.find(:first, :conditions => {:name => "Citibank"}, :include => :firm_with_primary_key) + citibank_result = Client.scoped(:conditions => {:name => "Citibank"}, :include => :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.find(:first, :conditions => {:name => "Citibank"}, :include => :firm_with_primary_key_symbols) + citibank_result = Client.scoped(:conditions => {:name => "Citibank"}, :include => :firm_with_primary_key_symbols).first assert citibank_result.association_cache.key?(:firm_with_primary_key_symbols) end @@ -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.find(:first, :order => "id"), c.firm_with_basic_id + assert_equal Firm.scoped(: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.find(:all, :limit => 2) + author1, author2 = Author.scoped(:limit => 2).all assert_not_nil author1 assert_not_nil author2 |