Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed warnings when a variable is shadowed

  • Loading branch information...
commit 247886e1b4256aeebc6b5fde0549400240b04e35 1 parent b22c11f
@strzalek strzalek authored tenderlove committed
View
4 activerecord/lib/active_record/association_preload.rb
@@ -112,13 +112,13 @@ def preload_one_association(records, association, preload_options={})
# Not all records have the same class, so group then preload
# group on the reflection itself so that if various subclass share the same association then we do not split them
# unnecessarily
- records.group_by {|record| class_to_reflection[record.class] ||= record.class.reflections[association]}.each do |reflection, records|
+ records.group_by { |record| class_to_reflection[record.class] ||= record.class.reflections[association]}.each do |reflection, _records|
raise ConfigurationError, "Association named '#{ association }' was not found; perhaps you misspelled it?" unless reflection
# 'reflection.macro' can return 'belongs_to', 'has_many', etc. Thus,
# the following could call 'preload_belongs_to_association',
# 'preload_has_many_association', etc.
- send("preload_#{reflection.macro}_association", records, reflection, preload_options)
+ send("preload_#{reflection.macro}_association", _records, reflection, preload_options)
end
end
View
6 activerecord/lib/active_record/associations/association_collection.rb
@@ -218,9 +218,9 @@ def count(column_name = nil, options = {})
# are actually removed from the database, that depends precisely on
# +delete_records+. They are in any case removed from the collection.
def delete(*records)
- remove_records(records) do |records, old_records|
+ remove_records(records) do |_records, old_records|
delete_records(old_records) if old_records.any?
- records.each { |record| @target.delete(record) }
+ _records.each { |record| @target.delete(record) }
end
end
@@ -231,7 +231,7 @@ def delete(*records)
# ignoring the +:dependent+ option.
def destroy(*records)
records = find(records) if records.any? {|record| record.kind_of?(Fixnum) || record.kind_of?(String)}
- remove_records(records) do |records, old_records|
+ remove_records(records) do |_records, old_records|
old_records.each { |record| record.destroy }
end
View
4 activerecord/test/cases/associations/inverse_associations_test.rb
@@ -412,7 +412,7 @@ def test_should_not_try_to_set_inverse_instances_when_the_inverse_is_a_has_many
i = interests(:trainspotting)
m = i.man
assert_not_nil m.interests
- iz = m.interests.detect {|iz| iz.id == i.id}
+ iz = m.interests.detect { |_iz| _iz.id == i.id}
assert_not_nil iz
assert_equal i.topic, iz.topic, "Interest topics should be the same before changes to child"
i.topic = 'Eating cheese with a spoon'
@@ -516,7 +516,7 @@ def test_should_not_try_to_set_inverse_instances_when_the_inverse_is_a_has_many
i = interests(:llama_wrangling)
m = i.polymorphic_man
assert_not_nil m.polymorphic_interests
- iz = m.polymorphic_interests.detect {|iz| iz.id == i.id}
+ iz = m.polymorphic_interests.detect { |_iz| _iz.id == i.id}
assert_not_nil iz
assert_equal i.topic, iz.topic, "Interest topics should be the same before changes to child"
i.topic = 'Eating cheese with a spoon'
View
4 activerecord/test/cases/base_test.rb
@@ -1816,8 +1816,8 @@ def test_to_xml_including_methods
def test_to_xml_with_block
value = "Rockin' the block"
- xml = Company.new.to_xml(:skip_instruct => true) do |xml|
- xml.tag! "arbitrary-element", value
+ xml = Company.new.to_xml(:skip_instruct => true) do |_xml|
+ _xml.tag! "arbitrary-element", value
end
assert_equal "<company>", xml.first(9)
assert xml.include?(%(<arbitrary-element>#{value}</arbitrary-element>))
View
6 activerecord/test/cases/fixtures_test.rb
@@ -36,7 +36,7 @@ def test_clean_fixtures
fixtures = nil
assert_nothing_raised { fixtures = create_fixtures(name) }
assert_kind_of(Fixtures, fixtures)
- fixtures.each { |name, fixture|
+ fixtures.each { |_name, fixture|
fixture.each { |key, value|
assert_match(MATCH_ATTRIBUTE_NAME, key)
}
@@ -229,9 +229,9 @@ def test_resets_to_min_pk_with_default_pk_and_sequence
def test_create_fixtures_resets_sequences_when_not_cached
@instances.each do |instance|
- max_id = create_fixtures(instance.class.table_name).inject(0) do |max_id, (name, fixture)|
+ max_id = create_fixtures(instance.class.table_name).inject(0) do |_max_id, (name, fixture)|
fixture_id = fixture['id'].to_i
- fixture_id > max_id ? fixture_id : max_id
+ fixture_id > _max_id ? fixture_id : _max_id
end
# Clone the last fixture to check that it gets the next greatest id.
Please sign in to comment.
Something went wrong with that request. Please try again.