Skip to content

Instantly share code, notes, and snippets.

@ruevaughn
Created April 7, 2012 21:23
Show Gist options
  • Save ruevaughn/2332198 to your computer and use it in GitHub Desktop.
Save ruevaughn/2332198 to your computer and use it in GitHub Desktop.
Rake Routes trying to match internationalization
Jensenlocksmithing::Application.routes.draw do
scope ":locale", locale: /#{I18n.available_locales.join("|")}/ do
get "log_out" => "sessions#destroy", as: "log_out"
get "log_in" => "sessions#new", as: "log_in"
resources :sites, except: [:new, :edit, :index, :show, :update, :destroy, :create] do
collection do
get :home
get :about_us
get :faq
get :discounts
get :services
get :contact_us
get :admin
get :posts
end
end
resources :users
resources :abouts
resources :sessions
resources :coupons
resources :monthly_posts
resources :reviews
resources :categories do
collection { post :sort }
resources :children, :controller => :categories, :only => [:index, :new, :create, :new_subcategory]
end
resources :products do
member do
put :move_up
put :move_down
end
end
resources :faqs do
collection { post :sort }
end
root :to => 'locale#root' # handles /en/
match "/savesort" => 'sites#savesort'
match "*path", to: "locale#not_found" # handles /en/fake/path/whatever
end
root to: redirect("/#{I18n.default_locale}") # handles /
#match '', to: redirect("/#{I18n.default_locale}")
match '*path', to: redirect("/#{I18n.default_locale}/%{path}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment