I have a patient model having so many columns. One column is date of birth having datetime datatype. In one case I had to insert value in patient table as date datatype instead of datetime in date of birth field.
In that case changeset is showing nil value but object changes showing data:
Changeset:
version.changeset[:date_of_birth]
=> [nil, nil]
Object changes:
"---\ndate_of_birth:\n- 1985-05-05 \n- 1985-05-05 \n"
But if date_of_birth having datetime, then changeset is showing
Object Changes:
version.object_changes
=> "---\ndate_of_birth:\n- 1985-05-05 00:00:00.000000000 Z\n- 1985-05-05
14:27:29.000000000 Z\n"
Changeset:
version.changeset[:date_of_birth]
=> [Sun, 05 May 1985 00:00:00 UTC +00:00, Sun, 05 May 1985 14:27:29 UTC +00:00]
Can someone help me in finding the solutions why changeset is showing nil but object changes having data.