Setting & getting virtual attributes in Rails model
问题 I'm looking for a rails-y way to approach the following: Two datetime attributes in an Event model: start_at: datetime end_at: datetime I would like to use 3 fields for accessing them in a form: event_date start_time end_time The problem I'm having is how to keep the actual and the virtual attributes in "sync" so the model can be updated via the form and/or directly via start_at & end_at . class Event < ActiveRecord::Base attr_accessible :end_at, :start_at, :start_time, :end_time, :event_date