Sha256: e2b663151f954e791b5577f015212f42c09e07c1fdc6d464ae68ecfdf8e3cc5a
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'active_support/concern' require 'active_model/dirty' module Ripple module AttributeMethods module Dirty extend ActiveSupport::Concern include ActiveModel::Dirty # @private def really_save(*args) if result = super @previously_changed = changes changed_attributes.clear end result end # @private def reload super.tap do changed_attributes.clear end end # @private def initialize(attrs={}) super(attrs) changed_attributes.clear end # Determines if the document has any chnages. # @return [Boolean] true if this document, or any of its embedded # documents at any level, have changed. def changed? super || self.class.embedded_associations.any? do |association| send(association.name).has_changed_documents? end end private def attribute=(attr_name, value) if self.class.properties.include?(attr_name.to_sym) && @attributes[attr_name] != value attribute_will_change!(attr_name) end super end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
seomoz-ripple-1.0.0.pre | lib/ripple/attribute_methods/dirty.rb |