Sha256: 7632a85edb9fdc87004b20bec40e9b6ebc5ef47f959b253174b61d52ff9d3b9c

Contents?: true

Size: 747 Bytes

Versions: 8

Compression:

Stored size: 747 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
      session = @<%= singular_table_name %>.sessions.create!
      cookies.signed.permanent[:session_token] = { value: session.id, 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.permit(:email, :password, :password_confirmation)
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authentication-zero-2.11.2 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.11.1 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.11.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.10.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.9.3 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.9.2 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.9.1 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.9.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt