1 class UserActionObserver < ActiveRecord::Observer
4 cattr_accessor :current_user
6 def before_create(model)
8 model.created_by = @@current_user
10 # ignore if the model doesn't have created_by
13 model.updated_by = @@current_user
15 # ignore if model doesn't have updated_by
19 def before_update(model)
21 model.updated_by = @@current_user
23 # ignore if the model doesn't have updated_by