Class: SignupController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/authkit/templates/app/controllers/signup_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/authkit/templates/app/controllers/signup_controller.rb', line 9

def create
  remember = params[:remember_me] == "1"

  @signup = Signup.new()

  if @signup.save
    (@signup.user, remember)
    respond_to do |format|
      format.json { head :no_content }
      format.html {
        redirect_to root_path
      }
    end
  else
    respond_to do |format|
      format.json { render json: { status: 'error', errors: @signup.errors }.to_json, status: 422 }
      format.html { render :new }
    end
  end
end

#newObject

Create a new Signup form model (found in app/forms/signup.rb)



5
6
7
# File 'lib/generators/authkit/templates/app/controllers/signup_controller.rb', line 5

def new
  @signup = Signup.new
end