我正在尝试改进我的rails项目中的i18n。导航工作正常我已经但我的表格有错误。
配置/ routes.rb中
map.namespace :admin, :path_prefix => '/:locale/admin' do |admin|
admin.resources :titles
end
map.connect ':locale/:controller/:action/:id'
map.connect ':locale/:controller/:action/:id.:format'
应用程序/视图/管理/标题/ _form.html.haml
- form_for([:admin, title], :url => {:id => title}) do |f|
表单加载正确的记录,我可以看到正确的信息但是当我保存(发布操作)时它会引发此错误
ActiveRecord::RecordNotFound in Admin/titlesController#1
{"commit"=>"Submit",
"title"=>{"price"=>"69.95",
"title"=>"Java How to Program",
"isbn"=>"0130125075",
"available"=>"0",
"copyright"=>"2000",
"author_id"=>"1",
"edition"=>"3",
"publisher_id"=>"1"},
"_method"=>"put",
"authenticity_token"=>"PmuWctSaS2JXYIG8EdjS9Y7VOK48sThiOTSn+4+gHLY=",
"id"=>"edit",
"locale"=>"en"}
我做错了什么?
答案 0 :(得分:0)
如果您为form_for帮助提供有关url的最具体信息
,也许- form_for([:admin, title], :url => url_for(:controller => 'admin/titles', :action => :update, :locale => params[:locale], :id => title)) do |f|