Skip to content

Instantly share code, notes, and snippets.

@ThomasHambach
Created February 9, 2015 11:01
Show Gist options
  • Save ThomasHambach/eb140f67e9b778c39eba to your computer and use it in GitHub Desktop.
Save ThomasHambach/eb140f67e9b778c39eba to your computer and use it in GitHub Desktop.
Rails redirect to default locale
Rails.application.routes.draw do
scope "/:locale" do
# blablabla..
end
root to: "welcome#index"
get '/:locale' => 'welcome#index', :as => 'locale_root'
end
class WelcomeController < ApplicationController
def index
if(params[:locale].nil?)
redirect_to locale_root_path, :status => :moved_permanently
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment