Closed abmahmoodi closed 7 years ago
@abmahmoodi have you checked that this is only happens when using reform and not part of rails 5.0 ?
By assigning a new Array to sensor_values
, you are overwriting the entirety of sensor_values
(i.e. all existing data) rather than just adding a new value. This is not caused by reform. ActiveRecord on its own would behave the same way.
Look into using insert
from within a populator: http://trailblazer.to/gems/reform/populator.html.
Thanks @niels by Populate_if_empty my problem is solved.
@abmahmoodi Glad this could be resolved. Consequently, could you please close this issue? (There should be a "Close issue" button underneath the comment form.) Thanks!
I have a problem with Reform in Rails with the details in http://stackoverflow.com/questions/37803585/rails-5-0-reform
I have 2 model with the following details:
My form classes for 2 model is the following code:
As you see I have 2 nested form for 2 model. In step 1 one record insert in to table with references:
output is:
and this is OK.
And in step 2 we have a record for device and I want to insert a record to sensor_values table with the device_id that we have:
output:
As you see, Reform does an additional transaction (
UPDATE "rubywebit_devices_sensor_values" ...
) why?