Module: ActiveRecord::Extension::WithScope
- Defined in:
- lib/vex/active_record/with_scope.rb
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
3 4 5 6 7 |
# File 'lib/vex/active_record/with_scope.rb', line 3 def self.included(klass) # # add a custom scope. klass.named_scope :with, lambda { |*args| ActiveRecord::Extension::WithScope.(*args) } end |
.options(*args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vex/active_record/with_scope.rb', line 9 def self.(*args) = args. if [:conditions] && !args.empty? raise "Cannot have multiple condition entries" end unless args.empty? = { :conditions => args }.update() end end |