RailsCasts Pro episodes are now free!

Learn more or hide this

Stephen St. Martin's Profile

GitHub User: stevestmartin

Site: twitter.com/stevestmartin

Comments by Stephen St. Martin

Avatar

you may want to update

ruby
match '*path', to: redirect("/#{I18n.default_locale}/%{path}")

to be something along the lines of

ruby
match '*path', to: redirect({|params, request| "/#{I18n.default_locale}#{request.fullpath}"})

If you want to maintain the request format sent in /posts.json, also it should be noted that a 302 redirect will not resubmit post data, possibly a 307. This method of redirection you need to pay close attention that any urls placed in ajax calls have the locale otherwise there may be some unforeseen bugs, especially with POST requests