From 8b5f4e474f30560da85f52dd64dc3b45d0338b93 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 22 Dec 2007 11:26:03 +0000 Subject: Ruby 1.9 compat: fix warnings, shadowed block vars, and unitialized instance vars git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../associations/has_and_belongs_to_many_association.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb') diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index b26ea586e5..e08bd04ebb 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -33,10 +33,10 @@ module ActiveRecord if ids.size == 1 id = ids.first.to_i - record = load_target.detect { |record| id == record.id } + record = load_target.detect { |r| id == r.id } expects_array ? [record] : record else - load_target.select { |record| ids.include?(record.id) } + load_target.select { |r| ids.include?(r.id) } end else conditions = "#{@finder_sql}" @@ -84,19 +84,19 @@ module ActiveRecord else columns = @owner.connection.columns(@reflection.options[:join_table], "#{@reflection.options[:join_table]} Columns") - attributes = columns.inject({}) do |attributes, column| + attributes = columns.inject({}) do |attrs, column| case column.name when @reflection.primary_key_name - attributes[column.name] = @owner.quoted_id + attrs[column.name] = @owner.quoted_id when @reflection.association_foreign_key - attributes[column.name] = record.quoted_id + attrs[column.name] = record.quoted_id else - if record.attributes.has_key?(column.name) + if record.has_attribute?(column.name) value = @owner.send(:quote_value, record[column.name], column) - attributes[column.name] = value unless value.nil? + attrs[column.name] = value unless value.nil? end end - attributes + attrs end sql = -- cgit v1.2.3