diff options
author | José Valim <jose.valim@gmail.com> | 2010-04-02 19:16:44 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-02 19:16:44 +0200 |
commit | 1cd3d296f527d7109f6e875b3b9c698ff19f8173 (patch) | |
tree | d79c8f57c5a00766ddaad3b57c8ccbf999123724 /activerecord/lib/active_record/named_scope.rb | |
parent | a0cdb0499eecd40ba18d33226767783e4a058847 (diff) | |
parent | 83ebe6224f546d2154ad4ed72bb3f2c9b07de678 (diff) | |
download | rails-1cd3d296f527d7109f6e875b3b9c698ff19f8173.tar.gz rails-1cd3d296f527d7109f6e875b3b9c698ff19f8173.tar.bz2 rails-1cd3d296f527d7109f6e875b3b9c698ff19f8173.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r-- | activerecord/lib/active_record/named_scope.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb index 9abf979cd0..3456332227 100644 --- a/activerecord/lib/active_record/named_scope.rb +++ b/activerecord/lib/active_record/named_scope.rb @@ -133,19 +133,16 @@ module ActiveRecord delegate :scopes, :with_scope, :with_exclusive_scope, :scoped_methods, :scoped, :to => :klass def self.init(klass, options, &block) - relation = new(klass, klass.arel_table) + relation = new(klass, klass.arel_table, &block) scope = if options.is_a?(Hash) - klass.scoped.apply_finder_options(options.except(:extend)) + klass.scoped.apply_finder_options(options) else options ? klass.scoped.merge(options) : klass.scoped end relation = relation.merge(scope) - Array.wrap(options[:extend]).each {|extension| relation.send(:extend, extension) } if options.is_a?(Hash) - relation.send(:extend, Module.new(&block)) if block_given? - relation.current_scoped_methods_when_defined = klass.send(:current_scoped_methods) relation end |