title: Separate date and time form fields in Rails
body: <p>I have an ActiveRecord model <code>Event</code>with a datetime column <code>starts_at</code>. I would like to present a form, where date and time for <code>starts_at</code> are chosen separately (e.g. <code>"23-10-2010"</code> for date and <code>"18:00"</code> for time). These fields should be backed by the single column <code>starts_at</code>, and validations should preferably be against <code>starts_at</code>, too.</p>
  
  <p>I can of course muck around with virtual attributes and hooks, but I would like a more elegant solution. I have experimented with both <code>composed_of</code> (<a href="http://api.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMethods.html" rel="noreferrer">rdoc</a>), and attribute-decorator (<a href="https://rails.lighthouseapp.com/projects/8994/tickets/950-attributedecorator-a-new-take-on-aggregation" rel="noreferrer">lighthouse discussion</a>, <a href="http://github.com/Fingertips/attribute-decorator" rel="noreferrer">github</a>) without success.</p>
  
  <p>Below is a rough outline of what I would like..</p>
  
  <pre><code>class Event &lt; ActiveRecord::Base
    validates_presence_of :start_date
  end
  
  # View
  # On submission this should set start_date.
  form_for @event do |f|
    f.text_field :starts_at_date         # date-part of start_date
    f.text_field :starts_at_time_of_day  # time-of-day-part of start_date
    f.submit
  end
  </code></pre>
  
  <p>Any help appreciated.</p>