【发布时间】:2014-11-18 14:37:25
【问题描述】:
使用 Rails 4 和 I18n。
当我像这样调用路径时
conversation_path(locale: :de, 1)
它给了我一个错误提示
No route matches {:action=>"show", :controller=>"frontend/conversations", :id=>1, :locale=>:de} missing required keys: [:locale]
routes.rb
scope '/:locale' do
localized do
scope module: 'frontend' do
resources :conversations, only: [:index, :show]
end
end
end
rake 路线给了我
conversation_de GET /:locale/conversations/:id(.:format) frontend/conversations#show {:locale=>"de"}
conversation_en GET /:locale/conversations/:id(.:format) frontend/conversations#show {:locale=>"en"}
我错过了什么吗?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 routes i18n-gem