Sha256: 6da739a29aaa64b2d9aa170ccc3254dc979a480411f48a614186a6617c1e6ea9

Contents?: true

Size: 405 Bytes

Versions: 1

Compression:

Stored size: 405 Bytes

Contents

class UserActionObserver < ActiveRecord::Observer
  observe User, Page, Layout, Snippet
  
  def self.current_user=(user)
    Thread.current[:current_user] = user
  end
  
  def self.current_user
    Thread.current[:current_user]
  end
  
  def before_create(model)
    model.created_by = self.class.current_user
  end
  
  def before_update(model)
    model.updated_by = self.class.current_user
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-1.0.0.rc1 app/models/user_action_observer.rb