diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-22 11:26:03 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-22 11:26:03 +0000 |
commit | 8b5f4e474f30560da85f52dd64dc3b45d0338b93 (patch) | |
tree | 0ba6fdc63093d9cc5549498d9f62238bea80a4cf /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | |
parent | dc901ced448179d9dfec924e22d8444b1a75265c (diff) | |
download | rails-8b5f4e474f30560da85f52dd64dc3b45d0338b93.tar.gz rails-8b5f4e474f30560da85f52dd64dc3b45d0338b93.tar.bz2 rails-8b5f4e474f30560da85f52dd64dc3b45d0338b93.zip |
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
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 16 |
1 files changed, 8 insertions, 8 deletions
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 = |