Sha256: cf7e5127a04aae8e5bffe6bae4b75552caa4c8e828bb7a8f0b9c871c6ef622fd

Contents?: true

Size: 464 Bytes

Versions: 10

Compression:

Stored size: 464 Bytes

Contents

class SessionsController < ApplicationController
  
  expose(:user) { User.authenticate(params[:session]) }
  
  def new
  end
  
  def create
    if user
      @current_user     = user
      session[:user_id] = user.id
      redirect_to(root_url, notice: "Successfully logged in!")      
    else
      render :new
    end
  end
  
  def destroy
    @current_user = session[:user_id] = nil
    redirect_to(root_url, notice: "Successfully logged out!")
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blogit-0.0.13 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.12 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.11 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.10 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.9 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.8 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.7 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.6 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.5 spec/dummy/app/controllers/sessions_controller.rb
blogit-0.0.4 spec/dummy/app/controllers/sessions_controller.rb