Sha256: eb0237ec31709c7fb3f7b58b280890f323cb8f3c215b33bbdf6f1456d3c7209d
Contents?: true
Size: 581 Bytes
Versions: 5
Compression:
Stored size: 581 Bytes
Contents
module CouchPotato module Persistence module DirtyAttributes def self.included(base) base.class_eval do after_save :reset_dirty_attributes end end def dirty? new? || self.class.properties.inject(false) do |res, property| res || property.dirty?(self) end end private def reset_dirty_attributes self.class.properties.each do |property| instance_variable_set("@#{property.name}_was", send(property.name)) end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems