aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-08-01 12:03:08 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-08-01 12:03:08 -0700
commit4b87854e541a47a485bb3b34dc6d090a48b8cc9c (patch)
tree2f15822e2b8b9c360fc605404fedec7eaebe745d /activerecord
parent5b527dc39d1e6dbfbe1515a88bf0ee77706f1ded (diff)
downloadrails-4b87854e541a47a485bb3b34dc6d090a48b8cc9c.tar.gz
rails-4b87854e541a47a485bb3b34dc6d090a48b8cc9c.tar.bz2
rails-4b87854e541a47a485bb3b34dc6d090a48b8cc9c.zip
remove intermediate assignments
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/builder/association.rb5
-rw-r--r--activerecord/lib/active_record/associations/builder/collection_association.rb6
2 files changed, 4 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb
index 22bc005b05..34de1a1f32 100644
--- a/activerecord/lib/active_record/associations/builder/association.rb
+++ b/activerecord/lib/active_record/associations/builder/association.rb
@@ -44,9 +44,8 @@ module ActiveRecord::Associations::Builder
validate_options
- if @scope && @scope.arity == 0
- prev_scope = @scope
- @scope = proc { instance_exec(&prev_scope) }
+ if scope && scope.arity == 0
+ @scope = proc { instance_exec(&scope) }
end
end
diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb
index bc63e18955..7bd0687c0b 100644
--- a/activerecord/lib/active_record/associations/builder/collection_association.rb
+++ b/activerecord/lib/active_record/associations/builder/collection_association.rb
@@ -78,10 +78,8 @@ module ActiveRecord::Associations::Builder
private
def wrap_scope(scope, mod)
- prev_scope = scope
-
- if prev_scope
- proc { |owner| instance_exec(owner, &prev_scope).extending(mod) }
+ if scope
+ proc { |owner| instance_exec(owner, &scope).extending(mod) }
else
proc { extending(mod) }
end