diff options
-rw-r--r-- | activerecord/lib/active_record/associations/builder/association.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/builder/collection_association.rb | 6 |
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 |