2010-12-09 8 views
0

Ich versuche, i18n auf meinem Schienenprojekt zu verbessern. Die Navigation funktioniert ok ich schon, aber ich habe einen Bug mit den Formularen.Formularfehler mit i18n auf Namespaces

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/Titel/_form.html.haml

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

Formular lädt den richtigen Datensatz, kann ich die richtigen Informationen sehen, aber wenn Ich speichere (post action) es löst diesen Fehler aus

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

Was mache ich falsch?

Antwort

0

Vielleicht, wenn Sie geben eine sehr spezifische Informationen über URL für Ihre form_for Helfer

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