diff --git a/activerecord/lib/active_record/associations/preloader/has_many_through.rb b/activerecord/lib/active_record/associations/preloader/has_many_through.rb index 38bc7ce7dad9e412b1a1d34ac3380d2eb8d24c08..0dc551f100b7baf8957b9c44ed7ab6a365e03d13 100644 --- a/activerecord/lib/active_record/associations/preloader/has_many_through.rb +++ b/activerecord/lib/active_record/associations/preloader/has_many_through.rb @@ -5,7 +5,7 @@ class HasManyThrough < CollectionAssociation #:nodoc: include ThroughAssociation def associated_records_by_owner - super.each do |owner, records| + super.each_value do |records| records.uniq! if reflection_scope.distinct_value end end diff --git a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb index a5a22bc30b8ad58eae0f59e66ec8e2b008957e85..e78cb88562d60ebd85e9919529a7bee4a2748a73 100644 --- a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb @@ -54,7 +54,7 @@ def test_copy_table_without_primary_key end def test_copy_table_with_id_col_that_is_not_primary_key - test_copy_table('goofy_string_id', 'goofy_string_id2') do |from, to, options| + test_copy_table('goofy_string_id', 'goofy_string_id2') do original_id = @connection.columns('goofy_string_id').detect{|col| col.name == 'id' } copied_id = @connection.columns('goofy_string_id2').detect{|col| col.name == 'id' } assert_equal original_id.type, copied_id.type @@ -65,7 +65,7 @@ def test_copy_table_with_id_col_that_is_not_primary_key end def test_copy_table_with_unconventional_primary_key - test_copy_table('owners', 'owners_unconventional') do |from, to, options| + test_copy_table('owners', 'owners_unconventional') do original_pk = @connection.primary_key('owners') copied_pk = @connection.primary_key('owners_unconventional') assert_equal original_pk, copied_pk