Class: RegistrationsController

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

Instance Method Summary collapse

Methods included from Devise::Controllers::InternalHelpers

#devise_controller?, #devise_mapping, included, #resource, #resource_class, #resource_name

Instance Method Details

#createObject

POST /resource/sign_up



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/registrations_controller.rb', line 14

def create
  build_resource

  if resource.save
    flash[:"#{resource_name}_signed_up"] = true
    set_flash_message :notice, :signed_up
    (resource_name, resource)
  else
    render_with_scope :new
  end
end

#destroyObject

DELETE /resource



42
43
44
45
46
# File 'app/controllers/registrations_controller.rb', line 42

def destroy
  self.resource.destroy
  set_flash_message :notice, :destroyed
  sign_out_and_redirect(self.resource)
end

#editObject

GET /resource/edit



27
28
29
# File 'app/controllers/registrations_controller.rb', line 27

def edit
  render_with_scope :edit
end

#newObject

GET /resource/sign_in



8
9
10
11
# File 'app/controllers/registrations_controller.rb', line 8

def new
  build_resource
  render_with_scope :new
end

#updateObject

PUT /resource



32
33
34
35
36
37
38
39
# File 'app/controllers/registrations_controller.rb', line 32

def update
  if self.resource.update_with_password(params[resource_name])
    set_flash_message :notice, :updated
    redirect_to (self.resource)
  else
    render_with_scope :edit
  end
end