Sha256: 4451c85b1740a05e74b592401cbf9f10f2d5e5dbcc7f16554eb4263a9b54abd8
Contents?: true
Size: 1.06 KB
Versions: 11
Compression:
Stored size: 1.06 KB
Contents
module Lockdown module Model def self.included(base) base.send :include, Lockdown::Model::InstanceMethods end module InstanceMethods def self.included(base) base.class_eval do alias :create_without_stamps :create alias :update_without_stamps :update end end def current_profile_id Thread.current[:profile_id] end def create_with_stamps profile_id = current_profile_id || Profile::SYSTEM self[:created_by] = profile_id if self.respond_to?(:created_by) self[:updated_by] = profile_id if self.respond_to?(:updated_by) create_without_stamps end alias :create :create_with_stamps def update_with_stamps profile_id = current_profile_id || Profile::SYSTEM self[:updated_by] = profile_id if self.respond_to?(:updated_by) update_without_stamps end alias :update :update_with_stamps end # InstanceMethods end # Model end # Lockdown Lockdown.orm_parent.send :include, Lockdown::Model
Version data entries
11 entries across 11 versions & 1 rubygems