mardi 17 décembre 2019

Rails: How to pass value "9999-99-99" to date if checkbox is checked?

I have a datepicker to :DATE and a "Unknown" checkbox aside. I need to pass "9999-99-99" to :DATE if checkbox is checked.

Here is my code.

1    <%= form.label :DATE %>
2    <%= form.datepicker :DATE %>
3    <div>
4      <label class="radio-inline"> <%=  form.check_box :DATE %> Unknown </label>
5    </div>

I also got an error for line 4:

undefined method 'to_i' for Thu, 19 Dec 2019:Date Did you mean? to_s.

In my database, :DATE is formatted as "YYYY-MM-DD".

Thanks.




Aucun commentaire:

Enregistrer un commentaire