Sha256: 8fdd964cf223f9e676ef6fa0b7a7fbfe98e3118015c455438327e0acd69e557a
Contents?: true
Size: 513 Bytes
Versions: 7
Compression:
Stored size: 513 Bytes
Contents
class UserActionObserver < ActiveRecord::Observer observe User, Page, Layout, Snippet def current_user=(user) self.class.current_user = user end def self.current_user=(user) Thread.current[:current_user] = user end def current_user self.class.current_user end def self.current_user Thread.current[:current_user] end def before_create(model) model.created_by = self.current_user end def before_update(model) model.updated_by = self.current_user end end
Version data entries
7 entries across 7 versions & 2 rubygems