Question:
I'm using strong_parameters
to create a nested shape object in a form
. All my attributes work correctly except those defined in datetime
.
Is there anything special about receiving nested datetime
?
Looking at the console, the attribute is being nested correctly, but it comes with the Ni
specification, with N
from 1 to 6 depending on which parameter it refers to (year, month, day…), but when creating the object ( INSERT INTO
), the attribute specified in datetime
does not appear:
Processing by ReleasesController#create as HTML
Parameters: {"utf8"=>"✓", ... "release"=>{ ... "qm_attributes"=>{"user_id"=>"1", "start_at(1i)"=>"2014", "start_at(2i)"=>"3", "start_at(3i)"=>"31", "start_at(4i)"=>"14", "start_at(5i)"=>"57", "end_at(1i)"=>"2014", "end_at(2i)"=>"3", "end_at(3i)"=>"31", "end_at(4i)"=>"14", "end_at(5i)"=>"57", ... }}, "commit"=>"Create Release"}
SQL (0.3ms) INSERT INTO "qms" ("created_at", "release_id", "tipo_qm_release", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?)
Answer:
I found that the html datetime_selector
doesn't work for objects nested in the form. When I passed the date by text everything worked fine, parsing the datetime
correctly. If anyone has questions about the whole process of using strong_parameters
, I can be more specific.