locale parameter changes his location in link
I have some serius problem, I created multiple language selection that
works great, but the link is changing all the time. From
http://localhost:3000/en/products when I click such link
<%= link_to image_tag('lv.png',:alt => 'description', :title => (I18n.t
'latvian') ), params.merge(:locale => :lv) %>
To something like this after some time I am navigating inside app and
clicking different links
http://localhost:3000/manufacturer_products?locale=en&manufacturer=Christophel
I believe that the problem is inside the routes.rb file.
This is my routes file.
root :to => 'home#index'
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
get "about_us/index"
namespace :products do
resources :categories do
resources :products
end
resources :products, only: :index
end
namespace :products do
resources :manufacturs do
resources :products
end
resources :products, only: :index
end
get "about/index"
match ":locale/products/search" => "products#search"
match "/contacts", to: "contacts#index"
match "/products", to: "products#index"
match "/home", to: "home#index"
match "/about_us", to: "about_us#index"
match "/news", to: "news#index"
match "/manufacturer_products", to: "manufacturer_products#index"
match '/:locale' => 'home#index'
scope "(:locale)", :locale => /en|lv|ru/ do
resources :products, :manufacturers, :categories, :news, :ActiveAdmin,
:manufacturer_products
end
I understand that I have to somehow merge namespace:products route with
locale route, but I have no idea to start with, If somebody could give me
a tip or smth :)
Thanks
No comments:
Post a Comment