Sha256: abed7204b7e808dd5161aa2c77a3e8f25d74ceb9cf3b209b132715e5670d2756
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module Pwb class DeviseController < ActionController::Base protect_from_forgery with: :exception before_filter :current_agency, :sections, :set_locale def set_locale agency = current_agency locale = agency.default_client_locale_to_use # below just causes confusion for now # if current_user # locale = current_user.default_client_locale # end if params[:locale] # passed in params override user's default locale = params[:locale] end I18n.locale = locale end # http://www.rubydoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper#devise_for-instance_method # below needed so devise can route links with correct locale def self.default_url_options { locale: I18n.locale } end private def current_agency @current_agency ||= (Agency.last || Agency.create) end def sections @sections ||= Section.where(visible: true).order("sort_order") @show_admin_link = true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pwb-0.0.1 | app/controllers/pwb/devise_controller.rb |