enscoped

An ActiveRecord scope builder-helper. Initially implemented for an older Rails 2 project, will be updated to work with Rails 3.

Example

class FancyModel < ActiveRecord::Base
  include Enscoped
  named_scope :informative
  named_scope :entertaining
  named_scope :brief
  named_scope :verbose
  named_scope :boring
  named_scope :exciting
  named_scope :free
  named_scope :expensive
end

# execute a query
FancyModel.enscoped(:informative, :entertaining).count

# just the hash condition
FancyModel.scope_for_scopes(:free, :expensive)

Copyright © 2011 Jon Morton. See LICENSE.txt for further details.