Created
October 23, 2016 10:30
-
-
Save andreas-it-dev/4f827c2317af2e53cf6ee485e649bddb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
force_ssl if: :ssl_configured? | |
before_action :set_locale | |
def set_locale | |
I18n.locale = params[:locale] || I18n.default_locale | |
end | |
def default_url_options | |
{ locale: I18n.locale == I18n.default_locale ? nil : I18n.locale } | |
end | |
def ssl_configured? | |
!Rails.env.development? | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
scope "/:locale" do | |
resources :messages | |
resource :session | |
root 'static#home' | |
get 'about', to: 'static#about' | |
get 'imprint', to: 'static#imprint' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment