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