9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/thoth/rails/model.rb', line 9
def log_events(options={})
defaults = {on: [:create, :update, :destroy]}
options = options.reverse_merge!(defaults)
options[:on] = Array(options[:on])
options[:only] = Array(options[:only])
class_attribute :thoth_options
self.thoth_options = options
after_create :thoth_log_create if options[:on].include?(:create)
before_update :thoth_log_update if options[:on].include?(:update)
after_destroy :thoth_log_destroy if options[:on].include?(:destroy)
end
|