diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-04-02 17:34:48 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-04-02 17:38:02 +0100 |
commit | b77dd218ce845f01753d02fcbc2605c9a5ee93e1 (patch) | |
tree | ea07dbe6965bd31ea7d066e04f7dad0e67e62f31 /activerecord/lib/active_record/named_scope.rb | |
parent | bc7da9b77d6347eeccefa2c735b2f236a08eea57 (diff) | |
download | rails-b77dd218ce845f01753d02fcbc2605c9a5ee93e1.tar.gz rails-b77dd218ce845f01753d02fcbc2605c9a5ee93e1.tar.bz2 rails-b77dd218ce845f01753d02fcbc2605c9a5ee93e1.zip |
Add Relation extensions
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 |