module Ddb::Userstamp::Stamper::InstanceMethods
Public Instance Methods
reset_stamper()
click to toggle source
Sets the stamper back to nil
to prepare for the next request.
# File lib/stamper.rb, line 35 def reset_stamper Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = nil end
stamper()
click to toggle source
Retrieves the existing stamper for the current request.
# File lib/stamper.rb, line 30 def stamper Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] end
stamper=(object)
click to toggle source
Used to set the stamper for a particular request. See the Userstamp
module for more details on how to use this method.
# File lib/stamper.rb, line 19 def stamper=(object) object_stamper = if object.is_a?(ActiveRecord::Base) object.send("#{object.class.primary_key}".to_sym) else object end Thread.current["#{self.to_s.downcase}_#{self.object_id}_stamper"] = object_stamper end