From b75c8e58ab2ea055324c6f95127b5b940e758d57 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 24 May 2013 11:20:20 +0200 Subject: Using 1.8.7 syntax for 3-2-stable --- .../test/cases/associations/has_many_associations_test.rb | 2 +- activerecord/test/cases/autosave_association_test.rb | 8 ++++---- activerecord/test/models/person.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 8fd9de07c9..a75d064ac0 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1496,7 +1496,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase david = people(:david) assert_equal ["A Modest Proposal"], david.essays.map(&:name) - david.essays = [Essay.create!(name: "Remote Work" )] + david.essays = [Essay.create!(:name => "Remote Work" )] assert_equal ["Remote Work"], david.essays.map(&:name) end diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index bb07cf4185..f7697fa77b 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -781,17 +781,17 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase end def test_should_save_new_record_that_has_same_value_as_existing_record_marked_for_destruction_on_field_that_has_unique_index - Bird.connection.add_index :birds, :name, unique: true + Bird.connection.add_index :birds, :name, :unique => true - 3.times { |i| @pirate.birds.create(name: "unique_birds_#{i}") } + 3.times { |i| @pirate.birds.create(:name => "unique_birds_#{i}") } @pirate.birds[0].mark_for_destruction - @pirate.birds.build(name: @pirate.birds[0].name) + @pirate.birds.build(:name => @pirate.birds[0].name) @pirate.save! assert_equal 3, @pirate.birds.reload.length ensure - Bird.connection.remove_index :birds, column: :name + Bird.connection.remove_index :birds, :column => :name end # Add and remove callbacks tests for association collections. diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index 3a7a730a1a..d316a0b992 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -27,7 +27,7 @@ class Person < ActiveRecord::Base has_many :agents_posts, :through => :agents, :source => :posts has_many :agents_posts_authors, :through => :agents_posts, :source => :author - has_many :essays, primary_key: "first_name", foreign_key: "writer_id" + has_many :essays, :primary_key => "first_name", :foreign_key => "writer_id" scope :males, :conditions => { :gender => 'M' } scope :females, :conditions => { :gender => 'F' } -- cgit v1.2.3 From 0e14973a3368945d9a7fddb4bfeefe3fc2f2a246 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 24 May 2013 11:20:43 +0200 Subject: It's scoped in 3-2-stable! scope => scoped --- activerecord/lib/active_record/associations/has_many_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index dab57bab88..5296cb7282 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -89,7 +89,7 @@ module ActiveRecord records.each { |r| r.destroy } update_counter(-records.length) unless inverse_updates_counter_cache? else - scope = self.scope.where(reflection.klass.primary_key => records) + scope = self.scoped.where(reflection.klass.primary_key => records) if method == :delete_all update_counter(-scope.delete_all) -- cgit v1.2.3