Class: RegistrationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/registration_generator/generators/registration/templates/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/registration_generator/generators/registration/templates/registrations_controller.rb', line 9

def create
  @user = User.new(user_params)

  if @user.save
    start_new_session_for @user
    redirect_to root_path, notice: "You have successfully registered!"
  else
    render :new, status: :unprocessable_entity
  end
end

#newObject



4
5
6
7
# File 'lib/registration_generator/generators/registration/templates/registrations_controller.rb', line 4

def new
  redirect_to root_path if authenticated?
  @user = User.new
end