Module: Chowder::Rails

Defined in:
lib/chowder/rails.rb

Instance Method Summary collapse

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/chowder/rails.rb', line 7

def authorized?
  session[:current_user]
end

#current_userObject



3
4
5
# File 'lib/chowder/rails.rb', line 3

def current_user
  session[:current_user]
end

#loginObject



11
12
13
14
# File 'lib/chowder/rails.rb', line 11

def 
  session[:redirect_to] = request.path_info
  redirect_to '/login'
end

#logoutObject



16
17
18
# File 'lib/chowder/rails.rb', line 16

def logout
  session[:current_user] = nil
end

#require_userObject



20
21
22
# File 'lib/chowder/rails.rb', line 20

def require_user
   unless authorized?
end