Rails observers are
sweet, You can
Then, in your fresh auditor_observer.rb file define the models you wish to
observe multiple
models within a single observer
First,
you need to generate your observer:
rails g observerAuditor
Then, in your fresh auditor_observer.rb file define the models you wish to
observe and
then add theafter_create callback.classAuditorObserver<ActiveRecord::Observer
observe :model_foo, :model_bar, :model_baz
def after_create(record)
#do something with `record`
end
end
No comments:
Post a Comment