RailsCasts Pro episodes are now free!

Learn more or hide this

Star Chow's Profile

GitHub User: starchow

Site: http://phamtrungnam.info

Comments by Star Chow

Avatar
ruby
Blog::Application.routes.draw do
  scope ':locale', locale: /#{I18n.available_locales.join("|")}/ do
    resources :articles
    root to: 'articles#index'
  end
  match '*path', to: redirect("/#{I18n.default_locale}/%{path}")
  match '', to: redirect("/#{I18n.default_locale}")
end

This routes config will have redirect loop error. When you go to http://localhost:3000/abc you will see it.

So i suggest config routes like this to avoid redirect loop error.

ruby
Blog::Application.routes.draw do
  scope ':locale', locale: /#{I18n.available_locales.join("|")}/ do
    resources :articles
    root to: 'articles#index'
    match '*path', to: redirect("/#{I18n.default_locale}")
  end
  match '*path', to: redirect("/#{I18n.default_locale}/%{path}")
  match '', to: redirect("/#{I18n.default_locale}")
end
Avatar

why backbone submit with double params?

ruby
Parameters: {"name"=>"test", "entry"=>{"name"=>"test"}}
Avatar

Thank Ryan.
Does Rails 3.1 can use the gem for rails 3.0 ?