1. 21 1月, 2019 1 次提交
    • A
      Fix year value when casting a multiparameter time hash · ccdedeb9
      Andrew White 提交于
      When assigning a hash to a time attribute that's missing a year
      component (e.g. a `time_select` with `:ignore_date` set to `true`)
      then the year defaults to 1970 instead of the expected 2000. This
      results in the attribute changing as a result of the save.
      
      Before:
      
          event = Event.new(start_time: { 4 => 20, 5 => 30 })
          event.start_time # => 1970-01-01 20:30:00 UTC
          event.save
          event.reload
          event.start_time # => 2000-01-01 20:30:00 UTC
      
      After:
      
          event = Event.new(start_time: { 4 => 20, 5 => 30 })
          event.start_time # => 2000-01-01 20:30:00 UTC
          event.save
          event.reload
          event.start_time # => 2000-01-01 20:30:00 UTC
      ccdedeb9
  2. 17 5月, 2018 1 次提交
  3. 12 3月, 2018 2 次提交
    • A
      Normalize date component when writing to time columns · 3f95054f
      Andrew White 提交于
      For legacy reasons Rails stores time columns on sqlite as full
      timestamp strings. However because the date component wasn't being
      normalized this meant that when they were read back they were being
      prefixed with 2001-01-01 by ActiveModel::Type::Time. This had a
      twofold result - first it meant that the fast code path wasn't being
      used because the string was invalid and second it was corrupting the
      second fractional component being read by the Date._parse code path.
      
      Fix this by a combination of normalizing the timestamps on writing
      and also changing Active Model to be more lenient when detecting
      whether a string starts with a date component before creating the
      dummy time value for parsing.
      3f95054f
    • A
      Apply time column precision on assignment · 4d9126cf
      Andrew White 提交于
      In #20317, datetime columns had their precision applied on assignment but
      that behaviour wasn't applied to time columns - this commit fixes that.
      
      Fixes #30301.
      4d9126cf
  4. 17 7月, 2017 1 次提交
  5. 02 7月, 2017 1 次提交
  6. 01 7月, 2017 1 次提交
  7. 07 8月, 2016 2 次提交
  8. 25 7月, 2016 1 次提交
  9. 05 1月, 2016 1 次提交
  10. 01 12月, 2015 1 次提交
  11. 22 9月, 2015 1 次提交
  12. 08 2月, 2015 2 次提交
    • S
      Move non-type objects into the `Type::Helpers` namespace · c4ef73af
      Sean Griffin 提交于
      The type code is actually quite accessible, and I'm planning to
      encourage people to look at the files in the `type` folder to learn more
      about how it works. This will help reduce the noise from code that is
      less about type casting, and more about random AR nonsense.
      c4ef73af
    • S
      Push multi-parameter assignement into the types · 631707a5
      Sean Griffin 提交于
      This allows us to remove `Type::Value#klass`, as it was only used for
      multi-parameter assignment to reach into the types internals. The
      relevant type objects now accept a hash in addition to their previous
      accepted arguments to `type_cast_from_user`. This required minor
      modifications to the tests, since previously they were relying on the
      fact that mulit-parameter assignement was reaching into the internals of
      time zone aware attributes. In reaility, changing those properties at
      runtime wouldn't change the accessor methods for all other forms of
      assignment.
      631707a5
  13. 15 1月, 2015 1 次提交
  14. 28 5月, 2014 1 次提交