Sha256: 44617fce199449d15b5a2dcb0dcf69cafd3f455f1b4c83bd8a0946c77db55b53
Contents?: true
Size: 818 Bytes
Versions: 7
Compression:
Stored size: 818 Bytes
Contents
module Maintain module Backend class ActiveRecord < Maintain::Backend::Base def aggregate(maintainee, name, attribute, states) # named_scope will handle the array of states as "IN" in SQL state(maintainee, name, attribute, states) end def read(instance, attribute) instance.read_attribute(attribute) end def state(maintainee, name, attribute, value) conditions = {:conditions => {attribute => value}} if defined?(::ActiveRecord::VERSION) && ::ActiveRecord::VERSION::STRING >= '3' maintainee.scope name, conditions else maintainee.named_scope name, conditions end end def write(instance, attribute, value) instance.send(:write_attribute, attribute, value) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems