Sha256: ca36287f5b524da346cd05b45ea60e35338415b2be2ec62239b1b42139f8b8ea
Contents?: true
Size: 673 Bytes
Versions: 7
Compression:
Stored size: 673 Bytes
Contents
# This stops the record from forgetting changes when the record # is saved. # # If you're interested in changes between subsequent saves # you can call #clear_changes! to clear them. # ActiveRecord::Base.class_eval do # alias :save :save_without_dirty # alias :save! :save_without_dirty! # # def clear_changes! # TODO figure out a better name # changed_attributes.clear # end # # def state_changes # if frozen? # [:deleted] # elsif just_created? # [:created] # elsif changed? # [:updated] # else # [] # end # end # # def just_created? # !!changes['id'] and changes['id'].first.nil? # end # end
Version data entries
7 entries across 7 versions & 2 rubygems