Hi all,
My app is generating a form with several bill_items that should be
updated (fields to be updated are description and net).
The text_field_tag names are bill_item[update][#{id}][description] and
bill_item[update][#{id}][net] (and I added bill_item[update][#{id}]
[id] just in case)
The param received is:
{“commit”=>“Save”,
“authenticity_token”=>“6184e60b9928fadecbdf3713ffcf770a2402c8c2”,
“bill_item”=>{“update”=>{“1”=>{“id”=>“1”,
“description”=>“Daily
monitoring”,
“net”=>“1:00”},
“2”=>{“id”=>“2”,
“description”=>“Development”,
“net”=>“3:00”}
}
},
“id”=>“1”}
How can I read/process this data?
I am trying to do something like
params[:bill_item][:update].each do |item|
bill_item = BillItem.find(item[id])
bill_item.description = item[description]
bill_item.net = item[net]
bill_item.save
end
but of course the access to the hash is not correct.