2011-08-17 50 views
2

我有一個嵌套窗體,並嘗試使用update_attributes來更新它,但它似乎不起作用。我正在使用導軌2.3.8嵌套窗體上的update_attributes不起作用

你能幫忙嗎?

Aanu

添加一些代碼

控制器代碼:

update 
@app.update_attributes(params[:application]) 
end 

@_params:

{"authenticity_token"=>"AdSr8o51u7GfnOwLSpEOe5xAPINd7ImxDpuayPk12No=", "_method"=>"put", "action"=>"update", "id"=>"10006", "stype"=>"Save", 
"application"=>{ 
    "contact_attributes"=>{"city"=>"Denver", "address"=>"7000 Drive", "zip"=>"22222", "first_name"=>"Randy"}, "details_attributes"=>{ 
     "2"=>{ "coverage"=>"false", "same_fee"=>"true", "fee_rate"=>"2000", "id"=>"10018", "year_estabilished"=>"2005"} 
    }} 
} 
+0

爲了得到幫助,請顯示一些代碼。 – Gerry

+0

增加了一些代碼 – Aanu

回答

0

那麼,你已經accepts_nested_attributes_for在模型中定義?看看這裏:http://apidock.com/rails/ActiveRecord/NestedAttributes/ClassMethods/accepts_nested_attributes_for

+0

是的。我有accepted_nested_attributes_for定義 – Aanu

+0

看起來像[(基於此鏈接)](https://rails.lighthouseapp.com/projects/8994/tickets/4766-nested_attributes-fails-to-updatedestroy-when-association-is-loaded- between-setting-attributes-and-saving-parent),2.3.8中的update_attributes存在問題。我想知道是否有任何解決辦法。 – Aanu