diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-04-13 13:12:28 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-04-13 13:17:43 +0100 |
commit | be89e9a35162b3015e2aee53300fdf04752652ce (patch) | |
tree | 35aad2aa257da5a1f416da2be1a98e03c4ba4337 /activerecord/lib/active_record/associations | |
parent | 8d5be98ad72939037f1be52aa4bb4672fff02abb (diff) | |
download | rails-be89e9a35162b3015e2aee53300fdf04752652ce.tar.gz rails-be89e9a35162b3015e2aee53300fdf04752652ce.tar.bz2 rails-be89e9a35162b3015e2aee53300fdf04752652ce.zip |
remove apply_finder_options call from AssociationScope
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/association_scope.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb index 2972b7e13e..5a44d3a156 100644 --- a/activerecord/lib/active_record/associations/association_scope.rb +++ b/activerecord/lib/active_record/associations/association_scope.rb @@ -15,19 +15,20 @@ module ActiveRecord def scope scope = klass.unscoped - scope = scope.extending(*Array(options[:extend])) + + scope.extending!(*Array(options[:extend])) # It's okay to just apply all these like this. The options will only be present if the # association supports that option; this is enforced by the association builder. - scope = scope.apply_finder_options(options.slice( - :readonly, :include, :references, :order, :limit, :joins, :group, :having, :offset, :select)) + scope.merge!(options.slice( + :readonly, :references, :order, :limit, :joins, :group, :having, :offset, :select, :uniq)) - if options[:through] && !options[:include] - scope = scope.includes(source_options[:include]) + if options[:include] + scope.includes! options[:include] + elsif options[:through] + scope.includes! source_options[:include] end - scope = scope.uniq if options[:uniq] - add_constraints(scope) end |