Class: Users::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Defined in:
app/controllers/virgo/users/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /resource


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/virgo/users/registrations_controller.rb', line 11

def create
  self.resource = build_resource()

  if resource.save

    if resource.active_for_authentication?
      set_flash_message :notice, :signed_up if is_navigational_format?
      (resource_name, resource)

      if params[:next].present?
        redirect_to(params[:next]) and return
      else
        redirect_to(virgo.root_path) and return
      end
    else
      set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
      expire_session_data_after_sign_in!
      respond_with resource, :location => virgo.(resource)
    end
  else
    clean_up_passwords resource
    respond_with resource
  end
end

#newObject


5
6
7
8
# File 'app/controllers/virgo/users/registrations_controller.rb', line 5

def new
  build_resource({})
  respond_with self.resource
end

#sign_up_paramsObject


36
37
38
39
# File 'app/controllers/virgo/users/registrations_controller.rb', line 36

def 
  params.require(:user).permit(:username, :nickname, :email, :first_name, :last_name, :password,
    :password_confirmation)
end