Module: HasUniqueToken

Defined in:
lib/has_unique_token.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
# File 'lib/has_unique_token.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
  base.class_eval do
    before_create :set_token, :unless => :token?
  end
end

Instance Method Details

#set_tokenObject

Instance methods



28
29
30
# File 'lib/has_unique_token.rb', line 28

def set_token
  self.token = self.class.token
end