| Module | WillPaginate::NamedScope |
| In: |
lib/will_paginate/named_scope.rb
|
This is a feature backported from Rails 2.1 because of its usefullness not only with will_paginate, but in other aspects when managing complex conditions that you want to be reusable.
All subclasses of ActiveRecord::Base have two named_scopes:
These anonymous scopes tend to be useful when procedurally generating complex queries, where passing intermediate values (scopes) around as first-class objects is convenient.
# File lib/will_paginate/named_scope.rb, line 11
11: def self.included(base)
12: base.class_eval do
13: extend ClassMethods
14: named_scope :scoped, lambda { |scope| scope }
15: end
16: end