1. 26 2月, 2019 1 次提交
  2. 25 2月, 2019 1 次提交
  3. 21 2月, 2019 1 次提交
  4. 20 2月, 2019 1 次提交
    • R
      Don't allow `where` with non numeric string matches to 0 values · 357cd23d
      Ryuta Kamizono 提交于
      This is a follow-up of #35310.
      
      Currently `Topic.find_by(id: "not-a-number")` matches to a `id = 0`
      record. That is considered as silently leaking information.
      
      If non numeric string is given to find by an integer column, it should
      not be matched to any record.
      
      Related #12793.
      357cd23d
  5. 18 2月, 2019 3 次提交
  6. 17 2月, 2019 1 次提交
  7. 31 1月, 2019 1 次提交
  8. 26 1月, 2019 1 次提交
  9. 23 1月, 2019 1 次提交
    • E
      Fix NumericalityValidator on object responding to `to_f`: · f01e3850
      Edouard CHIN 提交于
      - If you had a PORO that acted like a Numeric, the validator would
        work correctly because it was previously using `Kernel.Float`
        which is implicitely calling `to_f` on the passed argument.
      
        Since rails/rails@d126c0d , we are now using `BigDecimal` which does
        not implicitely call `to_f` on the argument, making the validator
        fail with an underlying `TypeError` exception.
      
        This patch replate the `is_decimal?` check with `Kernel.Float`.
        Using `Kernel.Float` as argument for the BigDecimal call has two
        advantages:
      
        1. It calls `to_f` implicetely for us.
        2. It's also smart enough to detect that `Kernel.Float("a")` isn't a
           Numeric and will raise an error.
           We don't need the `is_decimal?` check thanks to that.
      
        Passing `Float::DIG` as second argument to `BigDecimal` is mandatory
        because the precision can't be omitted when passing a Float.
        `Float::DIG` is what is used internally by ruby when calling
        `123.to_d`
      
        https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/util.rb#L47
      
      - Another small issue introduced in https://github.com/rails/rails/pull/34693
        would now raise a TypeError because `Regexp#===` will just return
        false if the passed argument isn't a string or symbol, whereas
        `Regexp#match?` will.
      f01e3850
  10. 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
  11. 19 1月, 2019 1 次提交
  12. 17 1月, 2019 1 次提交
  13. 09 1月, 2019 2 次提交
  14. 05 1月, 2019 1 次提交
  15. 31 12月, 2018 1 次提交
  16. 21 12月, 2018 3 次提交
  17. 20 12月, 2018 3 次提交
  18. 15 12月, 2018 1 次提交
  19. 13 12月, 2018 2 次提交
  20. 27 11月, 2018 1 次提交
  21. 21 11月, 2018 1 次提交
  22. 17 11月, 2018 1 次提交
  23. 13 11月, 2018 1 次提交
  24. 12 11月, 2018 1 次提交
    • R
      Ensure casting by decimal attribute when querying · a741208f
      Ryuta Kamizono 提交于
      Related 34cc301f.
      
      `QueryAttribute#value_for_database` calls only `type.serialize`, and
      `Decimal#serialize` is a no-op unlike other attribute types.
      
      Whether or not `serialize` will invoke `cast` is undefined in our test
      cases, but it actually does not work properly unless it does so for now.
      a741208f
  25. 07 11月, 2018 2 次提交
  26. 31 10月, 2018 1 次提交
    • S
      `update_columns` raises if the column is unknown · b63701e2
      Sean Griffin 提交于
      Previosly, `update_columns` would just take whatever keys you gave it
      and tried to run the update query. Most likely this would result in an
      error from the database. However, if the column actually did exist, but
      was in `ignored_columns`, this would result in the method returning
      successfully when it should have raised, and an attribute that should
      not exist written to `@attributes`.
      b63701e2
  27. 29 10月, 2018 1 次提交
  28. 21 10月, 2018 1 次提交
  29. 13 10月, 2018 1 次提交
    • D
      Improve model attribute accessor method names for backtraces · 99c87ad2
      Dylan Thacker-Smith 提交于
      Ruby uses the original method name, so will show the __temp__ method
      name in the backtrace. However, in the common case the method name
      is compatible with the `def` keyword, so we can avoid the __temp__
      method name in that case to improve the name shown in backtraces
      or TracePoint#method_id.
      99c87ad2
  30. 03 10月, 2018 1 次提交
  31. 02 10月, 2018 1 次提交