I think that you have a date and time field in your model, the rails allow you to read the part and time parts of the date separately in your forms (easily), and then simply combine them easily into the ONE date field. This works on purpose if your attribute is a date-time.
# model post.rb attr_accessible :published_on # just added here to show you that it accessible # form <%= form_for(@post) do |f| %> <%= f.date_select :published_on %> <%= f.time_select :published_on, :ignore_date => true %> <% end %>
The date picker will provide you with the publish_on date part. The selector string will give you the publish_on time part .: ignore_date => true ensures that the time picker does not display 3 hidden fields associated with publish_at, since you are already reading them in the previous line.
On the server side, date and time fields will be added!
If you, however, read the date as a text field, then this solution does not work, unfortunately. Since you are not using a composite attribute that provides rails for the built-in datetime.
In short, if you use date_select, time_select, the rails make things easier, otherwise you can look for other parameters.
source share