I'm trying to use a repeatable section of datetimes in a rails app using accepts_nested_attributes_for.
I have the following:
accepts_nested_attributes_for :meetings, :allow_destroy => true, :reject_if => lambda { |a| a[:starting_at].blank? }
In my view I am currently using a rails date_select
and a time_select
.
It won't save the submission though and I think it is because of starting_at
being a multi part datetime attribute. I have used a[:starting_at].blank?
in the past when working with text_fields but it doesn't seem to work with date_select/time_select fields.
Can anyone shed any light?
My other option would be to use a text_field
but I'm not sure how to do this so that the date and time are easy (and user-friendly to select) because if I use f.text_field :starting_at
it would combine both date and time in a single text field.
In the end it was easiest to just go with a text_field
. I just need to find a date time picker now (possibly the jquery UI one).