Class: Devise::CertificationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Devise::Controllers::InternalHelpers
Defined in:
app/controllers/devise/certifications_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject

GET /resource/certification/edit?certification_token=abcdef



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/devise/certifications_controller.rb', line 6

def edit
  self.resource = resource_class.find_resource_by_token(params[:certification_token])
  
  if resource.errors.empty?
    render_with_scope :edit
  else
    set_flash_message(:alert, :certification_token_invalid)
    redirect_to self.resource
  end
end

#updateObject

PUT /resource/certification



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/devise/certifications_controller.rb', line 18

def update
  self.resource = resource_class.certify_by_token(params[resource_name][:certification_token], current_certifier)
  params[resource_name].delete(:certification_token)
  self.resource.update_attributes(params[resource_name])
  if resource.errors.empty?
    set_flash_message :notice, :certified
    redirect_to self.resource
  else
    render_with_scope :edit
  end
end