Module: ActiveRecordCalculator::ClassMethods
- Defined in:
- lib/active_record_calculator.rb
Instance Method Summary collapse
- #calculator(options = {}) {|c| ... } ⇒ Object
- #updater(table, key, options = {}) {|c| ... } ⇒ Object
Instance Method Details
#calculator(options = {}) {|c| ... } ⇒ Object
17 18 19 20 21 |
# File 'lib/active_record_calculator.rb', line 17 def calculator( = {}, &blk) c = CalculatorProxy.new(self, ) yield c if blk c end |
#updater(table, key, options = {}) {|c| ... } ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/active_record_calculator.rb', line 23 def updater(table, key, = {}, &blk) if connection.adapter_name =~ /^sqlite/i raise UnsupportedAdapterError, "Updates with the database adapter is not supported." end c = CalculatorProxy.new(self, ) yield c if blk UpdaterProxy.new(table, key, c) end |