Module: Devise::Models::Certifiable::ClassMethods

Defined in:
lib/devise_certifiable/model.rb

Instance Method Summary collapse

Instance Method Details

#certification_tokenObject

Generate token



81
82
83
# File 'lib/devise_certifiable/model.rb', line 81

def certification_token
  generate_token(:certification_token)
end

#certify_by_token(certification_token, certification_authority) ⇒ Object



85
86
87
88
89
# File 'lib/devise_certifiable/model.rb', line 85

def certify_by_token(certification_token, certification_authority)
  certifiable = find_resource_by_token(certification_token)
  certifiable.certify!(certification_authority) if certifiable.persisted?
  certifiable
end

#find_resource_by_token(certification_token) ⇒ Object



91
92
93
# File 'lib/devise_certifiable/model.rb', line 91

def find_resource_by_token(certification_token)
  certifiable = find_or_initialize_with_error_by(:certification_token, certification_token)
end