Sha256: c164ac28c757ff8efe9aad20954cf89906185fbcb85d598351161fd5956bf69c

Contents?: true

Size: 743 Bytes

Versions: 10

Compression:

Stored size: 743 Bytes

Contents

class RegistrationsController < ApplicationController
  skip_before_action :authenticate

  def new
    @<%= singular_table_name %> = <%= class_name %>.new
  end

  def create
    @<%= singular_table_name %> = <%= class_name %>.new(<%= "#{singular_table_name}_params" %>)

    if @<%= singular_table_name %>.save
      cookies.signed[:session_token] = { value: @<%= singular_table_name %>.session_token, httponly: true }
      redirect_to root_path, notice: "Welcome! You have signed up successfully"
    else
      render :new, status: :unprocessable_entity
    end
  end

  private
    def <%= "#{singular_table_name}_params" %>
      params.require(:<%= singular_table_name %>).permit(:email, :password, :password_confirmation)
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
authentication-zero-1.0.2 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-1.0.1 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-1.0.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.24 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.23 lib/generators/authentication/templates/app/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.22 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.20 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.18 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.17 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-0.0.16 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt