Module: LogBook::Plugin::InstanceMethods
- Defined in:
- lib/log_book/plugin.rb
Instance Method Summary collapse
- #log_book_event_on_create ⇒ Object
- #log_book_event_on_destroy ⇒ Object
- #log_book_event_on_update ⇒ Object
Instance Method Details
#log_book_event_on_create ⇒ Object
27 28 29 |
# File 'lib/log_book/plugin.rb', line 27 def log_book_event_on_create LogBook.created(self.log_book_historian, self) if !self.log_book_mute end |
#log_book_event_on_destroy ⇒ Object
41 42 43 |
# File 'lib/log_book/plugin.rb', line 41 def log_book_event_on_destroy LogBook.destroyed(self.log_book_historian, self) if !self.log_book_mute end |
#log_book_event_on_update ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/log_book/plugin.rb', line 31 def log_book_event_on_update # TODO: this line of code is duplicated if ActiveRecord::VERSION::STRING.to_f >= 5.1 clean_changes = saved_changes.select { |k,v| !self.[:ignore].include? k.to_sym } else clean_changes = changes.select { |k,v| !self.[:ignore].include? k.to_sym } end LogBook.updated(self.log_book_historian, self) if !clean_changes.empty? and !self.log_book_mute end |