嵌套表单上的update_attributes不起作用

时间:2011-08-17 22:57:17

标签: ruby-on-rails ruby nested-forms

我有一个嵌套的表单,并尝试使用update_attributes更新它,但它似乎无法正常工作。我正在使用rails 2.3.8

你能帮忙吗?

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

1 个答案:

答案 0 :(得分:0)

那么,您的模型中是否定义了accepts_nested_attributes_for?看看这里:http://apidock.com/rails/ActiveRecord/NestedAttributes/ClassMethods/accepts_nested_attributes_for