Module: DataMapper::Model

Defined in:
lib/dm-adjust/model.rb

Instance Method Summary collapse

Instance Method Details

#adjust(attributes = {}, reload = false) ⇒ Object

Raises:

  • (NotImplementedError)


4
5
6
# File 'lib/dm-adjust/model.rb', line 4

def adjust(attributes = {}, reload = false)
  raise NotImplementedError, 'adjust *with* validations has not be written yet, try adjust!'
end

#adjust!(attributes, reload = false) ⇒ Object

increment or decrement attributes on all objects in a resource

Examples:

Usage

* People.adjust(:salary => +1000)
* Children.adjust(:allowance => -100)

Parameters:

  • attributes (Hash)

    A hash of attributes to adjust, and their adjustment



17
18
19
# File 'lib/dm-adjust/model.rb', line 17

def adjust!(attributes,reload=false)
  all.adjust!(attributes,reload)
end