Module: Ixtlan::ModifiedBy

Extended by:
DataMapper::Chainable
Defined in:
lib/ixtlan/modified_by.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

MODIFIED_BY_PROPERTIES =
{
  :updated_by => lambda {|r, u| r.updated_by = u},
  :created_by => lambda {|r, u| r.created_by = u if r.new? }
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



12
13
14
15
# File 'lib/ixtlan/modified_by.rb', line 12

def self.included(model)
  model.after :save do @current_user = nil; end
  model.extend(ClassMethods)
end

Instance Method Details

#current_user=(user) ⇒ Object



17
18
19
# File 'lib/ixtlan/modified_by.rb', line 17

def current_user=(user)
  @current_user = user
end