module ActiveRecord::DatetimeMultiparameterAttribute

ActiveRecord (temporal) extension to handle 2-field datetime attribute assignment

Private Instance Methods

read_time_parameter_value(name, values_hash_from_param) click to toggle source
Calls superclass method
# File lib/active_record/datetime_multiparameter_attribute.rb, line 6
def read_time_parameter_value(name, values_hash_from_param)
  if values_hash_from_param.size == 2
    t = Time.zone.parse("#{values_hash_from_param[1]} #{values_hash_from_param[2]}")
    if t
      values = [t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec]
      instantiate_time_object(name, values)
    else
      nil
    end
  else
    super
  end
end