main
1# frozen_string_literal: true
2
3class ApplicationController < ActionController::Base
4 include Authenticatable
5 include Featurable
6 protect_from_forgery with: :exception
7 around_action :apply_locale
8 add_flash_types :error, :warning
9
10 def render_error(status, model: nil)
11 @model = model
12 render template: "errors/#{status}", status: status
13 end
14
15 def apply_locale
16 I18n.with_locale(current_user&.locale || I18n.default_locale) do
17 yield
18 end
19 end
20end