Flowdock
method

read_time

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: MultiparameterAttribute

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v4.2.9) is shown here.

read_time() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/attribute_assignment.rb, line 151
      def read_time
        # If column is a :time (and not :date or :datetime) there is no need to validate if
        # there are year/month/day fields
        if cast_type.type == :time
          # if the column is a time set the values to their defaults as January 1, 1970, but only if they're nil
          { 1 => 1970, 2 => 1, 3 => 1 }.each do |key,value|
            values[key] ||= value
          end
        else
          # else column is a timestamp, so if Date bits were not provided, error
          validate_required_parameters!([1,2,3])

          # If Date bits were provided but blank, then return nil
          return if blank_date_parameter?
        end

        max_position = extract_max_param(6)
        set_values   = values.values_at(*(1..max_position))
        # If Time bits are not there, then default to 0
        (3..5).each { |i| set_values[i] = set_values[i].presence || 0 }
        instantiate_time_object(set_values)
      end
Register or log in to add new notes.