Sha256: 6d9ff09822a86d843416a6a94c367b44d55305b4bbc4085955403a30efae2b77
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryProtection for details # Scrub sensitive parameters from your log # filter_parameter_logging :password # borrowed from kete application (http://github.com/kete/kete) # modified to not rely only on mongo_translatable helpers before_filter :set_locale # first take the locale in the url, then the session[:locale], # then the users locale, finally the default site locale def set_locale if params[:locale] && TranslationsHelper.available_locales.include?(params[:locale]) I18n.locale = params[:locale] elsif session[:locale] && TranslationsHelper.available_locales.include?(session[:locale]) I18n.locale = session[:locale] else I18n.locale = I18n.default_locale end session[:locale] = I18n.locale # need to make sure this persists end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo_translatable-0.1.0 | test/full_2_3_5_app_with_tests/app/controllers/application_controller.rb |