Advertisement
saasbook

sessions_controller.rb

Feb 20th, 2012
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.58 KB | None | 0 0
  1. class SessionsController < ApplicationController
  2.   # user shouldn't have to be logged in before logging in!
  3.   skip_before_filter :set_current_user
  4.   def new
  5.     # code to enable user to login; should submit to 'create' action
  6.   end
  7.   def create
  8.     # determine which user has successfully logged in, then:
  9.     session[:user_id] = user.id
  10.     flash[:notice] = 'You have successfully logged in.'
  11.     redirect_to movies_path
  12.   end
  13.   def destroy
  14.     # forget the valid user
  15.     session.delete(:user_id)
  16.     flash[:notice] = 'You have successfully logged in.'
  17.     redirect_to movies_path
  18.   end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement