Files
railsgoat/app/controllers/application_controller.rb
T
2013-04-25 00:19:00 -04:00

20 lines
405 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_id(session[:id].to_s)
end
def authenticated
redirect_to root_url and reset_session if not current_user
end
end