I have different languages in my app and I am using this pattern: /:locale/some-action
. Most of my routes are in this scope :locale
- routes.rb:
scope "(:locale)", locale: /fr|en/ do
root to: 'home#index'
get 'contacts', to: 'contacts#index'
end
get 'about', to: 'about#index'
, but some of them are not. For routes which are in this scope :locale
, if I use their names like contacts_path
, Rails generates the route depends on the locale. If it is :fr
, generated route will be /fr/contacts
.
For routes which aren't in this scope. For the example about
. If I use its name about_path
and locale is :fr
, the generated URL will be /about?locale=fr
, but I don't want this.
What is the way to remove this GET parameter, but still using routes which are in scope :locale
with their names and generated URLs depends on :locale
?
Aucun commentaire:
Enregistrer un commentaire