Module: MintyScopes::Except
- Defined in:
- lib/minty_scopes/except.rb
Class Method Summary collapse
Class Method Details
.extended(within) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/minty_scopes/except.rb', line 4 def self.extended(within) within.class_eval do # Allow easy rejection of items. # Can take an a single id or ActiveRecord object, or an array of them named_scope :except, lambda { |*args| args.flatten! raise "The 'except' named_scope expects no nil values." unless args.all? { :conditions => ["#{quoted_table_name}.#{primary_key} NOT IN (?)", args] } } end end |