From 70c589584b397a6784eb2f9429461d6744db538c Mon Sep 17 00:00:00 2001 From: Nikos Dimitrakopoulos Date: Sun, 21 Apr 2013 21:28:13 +0300 Subject: [PATCH] Provide a memoized helper for current phase inside a request. Refs #15. --- app/controllers/application_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 769a5ab..d3c09cc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base protect_from_forgery check_authorization - helper_method :current_user, :user_signed_in? + helper_method :current_user, :user_signed_in?, :current_phase before_filter :reload_settings if Rails.env.development? @@ -36,4 +36,8 @@ def user_signed_in? def current_user @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id] end + + def current_phase + @current_phase ||= Phase.current + end end