master
1class ApplicationController < ActionController::Base
2 include Authenticatable
3 include Internationalizationable
4 include Pageable
5 include ErrorHandleable
6 # Prevent CSRF attacks by raising an exception.
7 # For APIs, you may want to use :null_session instead.
8 protect_from_forgery with: :exception
9 rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
10 helper_method :feature_enabled?
11
12 def feature_enabled?(feature)
13 return true if Rails.env.test?
14 $flipper[feature.to_sym].enabled?(current_user)
15 end
16
17 def record_not_found
18 render text: "404 Not Found", status: 404
19 end
20
21 def within_transaction
22 ActiveRecord::Base.transaction do
23 yield
24 end
25 end
26end
27