Methods
Attributes
| [R] | proxy_options | |
| [R] | proxy_scope |
Public Class methods
[ show source ]
# File lib/active_record/named_scope.rb, line 113
113: def initialize(proxy_scope, options, &block)
114: [options[:extend]].flatten.each { |extension| extend extension } if options[:extend]
115: extend Module.new(&block) if block_given?
116: @proxy_scope, @proxy_options = proxy_scope, options.except(:extend)
117: end
Public Instance methods
[ show source ]
# File lib/active_record/named_scope.rb, line 139
139: def empty?
140: @found ? @found.empty? : count.zero?
141: end
[ show source ]
# File lib/active_record/named_scope.rb, line 123
123: def first(*args)
124: if args.first.kind_of?(Integer) || (@found && !args.first.kind_of?(Hash))
125: proxy_found.first(*args)
126: else
127: find(:first, *args)
128: end
129: end
[ show source ]
# File lib/active_record/named_scope.rb, line 131
131: def last(*args)
132: if args.first.kind_of?(Integer) || (@found && !args.first.kind_of?(Hash))
133: proxy_found.last(*args)
134: else
135: find(:last, *args)
136: end
137: end
[ show source ]
# File lib/active_record/named_scope.rb, line 119
119: def reload
120: load_found; self
121: end
Protected Instance methods
[ show source ]
# File lib/active_record/named_scope.rb, line 144
144: def proxy_found
145: @found || load_found
146: end