我有一些严重的问题,我创建了多种语言选择,效果很好,但链接一直在变化。从http://localhost:3000/en/products
我点击这样的链接开始
<%= link_to image_tag('en.png',:alt => 'description', :title => (I18n.t 'english') ), params.merge(:locale => :en) %>
一段时间后,我在应用程序内部导航并单击不同的链接
http://localhost:3000/manufacturer_products?locale=en&manufacturer=Christophel
我相信问题出在 routes.rb 文件中。
这是我的路线文件。
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
我知道我必须以某种方式将 namespace:products 路由与 locale 路由合并,但我不知道从哪里开始,如果有人可以给我一个小费或 smth :)
谢谢