Sha256: 4ada302886f09d87bdc5bc6d61fc4787fc6b086068c3c7c03f3e546da25635cd
Contents?: true
Size: 807 Bytes
Versions: 15
Compression:
Stored size: 807 Bytes
Contents
module Locomotive module Concerns # When called, the account_required method enhances the controller by: # # - checking if someone is authentified or not. # - setting the right locale for the UI based on the authenticated account. # module AccountController extend ActiveSupport::Concern private def require_account authenticate_locomotive_account! end def set_back_office_locale ::I18n.locale = current_locomotive_account.locale rescue Locomotive.config.default_locale end public module ClassMethods def account_required class_eval do before_action :require_account before_action :set_back_office_locale end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems