Sha256: f514310e95148ce722d47b0685ae77641d18a28cff1d24d2793f712940c1c32b

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

class UserSessionsController < SbController
  
  protect_from_forgery
  
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => :destroy
  
  def new
    @user_session = UserSession.new
  end
  
  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.save
      flash[:notice] = "Login successful!"
      redirect_back_or_default root_url
    else
      render :action => :new
    end
  end
  
  def destroy
    current_user_session.destroy
    flash[:notice] = "Logout successful!"
    redirect_back_or_default login_url
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
santey_blog-0.2.1 app/controllers/user_sessions_controller.rb
santey_blog-0.2.0 app/controllers/user_sessions_controller.rb