diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-07-13 21:20:12 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-07-13 21:20:26 +0100 |
commit | 7fa9cb58c6e3b9311f0306173c48874ace7a6b04 (patch) | |
tree | 5fccd177bb0f63279e4f6ced60c1f4ac8b5f28ff /activerecord/lib/active_record/associations/association_scope.rb | |
parent | 8baaa452fd8b3688719573977f05b89a9f5b1e6d (diff) | |
download | rails-7fa9cb58c6e3b9311f0306173c48874ace7a6b04.tar.gz rails-7fa9cb58c6e3b9311f0306173c48874ace7a6b04.tar.bz2 rails-7fa9cb58c6e3b9311f0306173c48874ace7a6b04.zip |
fix association :extend option
Diffstat (limited to 'activerecord/lib/active_record/associations/association_scope.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 1c06fb2681..1303822868 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -15,9 +15,7 @@ module ActiveRecord def scope scope = klass.unscoped - scope.extending!(*Array(options[:extend])) scope.merge! eval_scope(klass, reflection.scope) if reflection.scope - add_constraints(scope) end @@ -120,10 +118,8 @@ module ActiveRecord end def eval_scope(klass, scope) - return scope if scope.is_a?(Relation) - - if scope.arity == 0 - klass.unscoped.instance_exec(&scope) + if scope.is_a?(Relation) + scope else klass.unscoped.instance_exec(owner, &scope) end |