ive generated a scaffolding for my application. The DB has a date and time field that I want to set tu current date and time that the form is submitted.
I created at _form.html.erb
<div class="field">
<%= f.label :t_date %><br />
<%= f.date_select :t_date %>
</div>
<div class="field">
<%= f.label :t_time %><br />
<%= f.time_select :t_time %>
</div>
But I dont want the user to set them, but the have to pass as a form argument.
I tought about hidden fields for them, but even if I set them as hidden, you could send a bad form trought json or a POST request am i right?
What would be the right way to pass the current date and time, save them to the db and showing them without the user notice?
If the form is used to create or update a model, you would just use the timestamping facility that Activerecord provides.
From the docs: