diff options
| author | mo khan <mo@mokhan.ca> | 2016-05-01 17:20:48 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-05-01 17:20:48 -0600 |
| commit | 115dfe33d4c1562d16791bf532da9dfe32919a22 (patch) | |
| tree | 3f4f052c6a19a746bd1929561357309692a37140 /app/controllers/application_controller.rb | |
| parent | 81faa433fbef6bd19738c46cf48bdca783a1ecd8 (diff) | |
extract helper method for feature toggles.
Diffstat (limited to 'app/controllers/application_controller.rb')
| -rw-r--r-- | app/controllers/application_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5c34a5f..976e38e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :authenticate! rescue_from ActiveRecord::RecordNotFound, with: :record_not_found - helper_method :current_user + helper_method :current_user, :feature_available? protected @@ -16,6 +16,10 @@ class ApplicationController < ActionController::Base @current_user ||= current_session.try(:user) end + def feature_available?(feature) + $flipper[feature.to_sym].enabled?(current_user) + end + def translate(key) I18n.translate("#{params[:controller]}.#{params[:action]}#{key}") end |
