Pregunta

Is there a way to "wrap" an existing rails 4 routing from a rails engine into a routing scope like described here: Rails routes with optional scope ":locale" ?

I want to use the spree gem (https://github.com/spree/spree) and insert the current locale as the leftmost part of the path, like /en/products/t-shirt

¿Fue útil?

Solución

You should be able to do it the same way:

Sandbox::Application.routes.draw do
  scope "(:locale)", locale: /en|fr/ do
    mount Spree::Core::Engine, :at => '/'
  end
end

You'll need to do more work to tie this locale in to Spree's locale, but that's a good place to start.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top