Sha256: bd49784412059a31fb25c934ffab8b9822e21c86610cb4d8a787d32bd131642d

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

class <%= user_session_plural_class_name %>Controller < ApplicationController

  before_filter :login_required,  :only   => :destroy
  before_filter :logout_required, :except => :destroy

  def new
    @<%= user_session_singular_name %> = <%= user_session_class_name %>.new
  end

  def create
    @<%= user_session_singular_name %> = <%= user_session_class_name %>.new(params[:<%= user_session_singular_name %>])
    if @<%= user_session_singular_name %>.save
      flash[:notice] = t(:success)
      redirect_to root_url
    else
      render :action => 'new'
    end
  end

  def destroy
    current_<%= user_session_singular_name %>.destroy
    flash[:notice] = t(:success)
    redirect_to root_url
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iain-pizza-generators-0.1.3 rails_generators/pizza_authentication/templates/sessions_controller.rb