module LogBook::Plugin::ClassMethods

Public Instance Methods

log_book(opts = {}) click to toggle source
# File lib/log_book/plugin.rb, line 8
def log_book(opts = {})
  after_create :log_book_event_on_create
  after_update :log_book_event_on_update
  after_touch :log_book_event_on_update
  before_destroy :log_book_event_on_destroy

  has_many :log_book_events, :class_name => "LogBook::Event", :as => :historizable, :dependent => (opts[:dependent] || :nullify)

  attr_accessor :log_book_historian
  attr_accessor :log_book_mute
  cattr_accessor :log_book_options

  self.log_book_options = opts
  self.log_book_options[:ignore] ||= []
  self.log_book_options[:ignore] << :updated_at # ignoring noisy field
end