Sha256: aacb5350a7af3cbc75719fdd0175b0932142a5e9f7298ac37b2b7789963b4935
Contents?: true
Size: 665 Bytes
Versions: 2
Compression:
Stored size: 665 Bytes
Contents
module DataMapper module Resource def adjust(attributes = {}, reload = false) raise NotImplementedError, 'adjust *with* validations has not be written yet, try adjust!' end def adjust!(attributes = {}, reload = false) return true if attributes.empty? adjust_attributes = {} model.properties(repository.name).values_at(*attributes.keys).each do |property| adjust_attributes[property] = attributes[property.name] if property end repository.adapter.adjust(adjust_attributes, query) collection.reload(:fields => adjust_attributes.keys) if reload true end end # Resource end # DataMapper
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-adjust-0.10.1 | lib/dm-adjust/resource.rb |
dm-adjust-0.10.0 | lib/dm-adjust/resource.rb |