Class: CreatedAndUpdatedBy::Stamper

Inherits:
Object
  • Object
show all
Defined in:
lib/created-and-updated-by.rb

Class Method Summary collapse

Class Method Details

.attach(stamp_model = User, stamp_attribute = :current) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
# File 'lib/created-and-updated-by.rb', line 4

def self.attach(stamp_model = User, stamp_attribute = :current)
	raise ArgumentError, "#{stamp_model.name} does not respond to #{stamp_attribute}" unless stamp_model.respond_to?(stamp_attribute)
	self.stampable, self.attribute = stamp_model, stamp_attribute
	ActiveRecord::Base.send(:include, CreatedAndUpdatedBy)
end