Sha256: d0b87cfc4b2684e1ac0b0d26adac5e5dfa974f3ee42af0b3e7401ebca0c06dee

Contents?: true

Size: 423 Bytes

Versions: 8

Compression:

Stored size: 423 Bytes

Contents

module Trestle
  module Auth
    module Controller
      module Locale
        extend ActiveSupport::Concern

        included do
          around_action :set_locale, if: :logged_in? if Trestle.config.auth.locale
        end

      protected
        def set_locale
          I18n.with_locale(instance_exec(current_user, &Trestle.config.auth.locale) || I18n.default_locale) { yield }
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trestle-auth-0.5.0 lib/trestle/auth/controller/locale.rb
trestle-auth-0.5.0.pre2 lib/trestle/auth/controller/locale.rb
trestle-auth-0.5.0.pre lib/trestle/auth/controller/locale.rb
trestle-auth-0.4.4 lib/trestle/auth/controller/locale.rb
trestle-auth-0.4.3 lib/trestle/auth/controller/locale.rb
trestle-auth-0.4.2 lib/trestle/auth/controller/locale.rb
trestle-auth-0.4.1 lib/trestle/auth/controller/locale.rb
trestle-auth-0.4.0 lib/trestle/auth/controller/locale.rb