module LogBook::Plugin::InstanceMethods

Public Instance Methods

log_book_event_on_create() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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.log_book_options[:ignore].include? k.to_sym }
  else
    clean_changes = changes.select { |k,v| !self.log_book_options[:ignore].include? k.to_sym }
  end
  LogBook.updated(self.log_book_historian, self) if !clean_changes.empty? and !self.log_book_mute
end