开发者

form error with i18n on namespaces

I'm trying to 开发者_高级运维improve i18n on my rails project. Navigation is working ok I already but I have a bug with the forms.

config/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'

app/views/admin/titles/_form.html.haml

 - form_for([:admin, title], :url => {:id => title}) do |f|

Form loads the right record, I can see the correct info but when I save (post action) it raises this error

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"}

What I'm doing wrong?


Maybe if you give a most specific info about url for your form_for helper

- form_for([:admin, title], :url => url_for(:controller => 'admin/titles', :action => :update, :locale => params[:locale], :id => title)) do |f|
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜