Module: Squeel::Adapters::ActiveRecord::BaseExtensions

Defined in:
lib/squeel/adapters/active_record/base_extensions.rb

Instance Method Summary collapse

Instance Method Details

#sifter(name = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/squeel/adapters/active_record/base_extensions.rb', line 10

def sifter(name = nil)
  if Symbol === name && block_given?
    singleton_class.send :define_method, "sifter_#{name}",
                          lambda {|*args| DSL.exec(*args, &Proc.new)}
  else
    raise ArgumentError, "A name and block are required"
  end
end

#squeel(&block) ⇒ Object



6
7
8
# File 'lib/squeel/adapters/active_record/base_extensions.rb', line 6

def squeel(&block)
  DSL.eval &block
end