20 lines
415 B
Ruby
Executable File
20 lines
415 B
Ruby
Executable File
class ApplicationController < ActionController::Base
|
|
|
|
before_filter :authenticated
|
|
helper_method :current_user
|
|
|
|
# Our security guy keep talking about sea-surfing, cool story bro.
|
|
#protect_from_forgery
|
|
|
|
private
|
|
|
|
def current_user
|
|
@current_user ||= User.find_by_user_id(session[:user_id].to_s)
|
|
end
|
|
|
|
def authenticated
|
|
redirect_to root_url and reset_session if not current_user
|
|
end
|
|
|
|
end
|