In the controller (update action), when I try to retrieve data from the
post request, I only can retrieve the value of the id with @test =
params[:id]), but not for example the value of ref_reckind_id with @test
= :ref_reckind_id.
Do somone have any suggestion how to retrieve the values of the other
attributes?
In the controller (update action), when I try to retrieve data from the
post request, I only can retrieve the value of the id with @test =
params[:id]), but not for example the value of ref_reckind_id with @test
= :ref_reckind_id.
Since ref_reckind_id is nested inside tbl_test you will have to use
something like
params[:tbl_test][:ref_recking_id]
The :ref_reckind_id key is inside a hash that is itself inside the params hash.
Try this:
params[:tbl_test][:ref_reckat_id].
But typically, you will not use this formulation directly, rather code like:
tbl_test = TblTest.find(params[:id])
if tbl_test.update_attributes(params[:tbl_test]) # here the “internal” hash is supplied to update_attributes)
# success
else
# handle failure