Class ActiveRecord::NamedScope::Scope
In: vendor/rails/activerecord/lib/active_record/named_scope.rb
Parent: Object

Methods

empty?   first   last   new   proxy_found   reload  

Attributes

proxy_options  [R] 
proxy_scope  [R] 

Public Class methods

[Source]

     # File vendor/rails/activerecord/lib/active_record/named_scope.rb, line 112
112:       def initialize(proxy_scope, options, &block)
113:         [options[:extend]].flatten.each { |extension| extend extension } if options[:extend]
114:         extend Module.new(&block) if block_given?
115:         @proxy_scope, @proxy_options = proxy_scope, options.except(:extend)
116:       end

Public Instance methods

[Source]

     # File vendor/rails/activerecord/lib/active_record/named_scope.rb, line 138
138:       def empty?
139:         @found ? @found.empty? : count.zero?
140:       end

[Source]

     # File vendor/rails/activerecord/lib/active_record/named_scope.rb, line 122
122:       def first(*args)
123:         if args.first.kind_of?(Integer) || (@found && !args.first.kind_of?(Hash))
124:           proxy_found.first(*args)
125:         else
126:           find(:first, *args)
127:         end
128:       end

[Source]

     # File vendor/rails/activerecord/lib/active_record/named_scope.rb, line 130
130:       def last(*args)
131:         if args.first.kind_of?(Integer) || (@found && !args.first.kind_of?(Hash))
132:           proxy_found.last(*args)
133:         else
134:           find(:last, *args)
135:         end
136:       end

[Source]

     # File vendor/rails/activerecord/lib/active_record/named_scope.rb, line 118
118:       def reload
119:         load_found; self
120:       end

Protected Instance methods

[Source]

     # File vendor/rails/activerecord/lib/active_record/named_scope.rb, line 143
143:       def proxy_found
144:         @found || load_found
145:       end

[Validate]