Class: OhMyLog::ActiveRecordObserver
- Inherits:
-
ActiveRecord::Observer
- Object
- ActiveRecord::Observer
- OhMyLog::ActiveRecordObserver
- Defined in:
- lib/oh_my_log/active_record_observer.rb
Instance Method Summary collapse
-
#after_save(model) ⇒ Object
this is the callback that happens every time after we made changes to the model.
Instance Method Details
#after_save(model) ⇒ Object
this is the callback that happens every time after we made changes to the model
5 6 7 8 9 |
# File 'lib/oh_my_log/active_record_observer.rb', line 5 def after_save(model) #we only add this model in the target list if this model got SUCCESSFULLY change must_be_logged = model.methods.include?(:saved_changes) ? model.saved_changes.empty? : model.changes.empty? Log::add_target(model) unless must_be_logged end |