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

Version Path
adva-0.1.4 lib/rails_ext/active_record/sticky_changes.rb
adva-0.1.3 lib/rails_ext/active_record/sticky_changes.rb
adva-0.1.2 lib/rails_ext/active_record/sticky_changes.rb
adva-0.1.1 lib/rails_ext/active_record/sticky_changes.rb
adva-0.1.0 lib/rails_ext/active_record/sticky_changes.rb
adva_cms-0.0.1 lib/rails_ext/active_record/sticky_changes.rb
adva-0.0.1 adva_cms/lib/rails_ext/active_record/sticky_changes.rb