1. 21 11月, 2018 1 次提交
  2. 07 9月, 2018 1 次提交
  3. 23 8月, 2018 1 次提交
    • R
      Fix numericality validator to still use value before type cast except Active Record · 47a6d788
      Ryuta Kamizono 提交于
      The purpose of fe9547b6 is to work type casting to value from database.
      
      But that was caused not to use the value before type cast even except
      Active Record.
      
      There we never guarantees that the value before type cast was going to
      the used in this validation, but we should not change the behavior
      unless there is some particular reason.
      
      To restore original behavior, still use the value before type cast if
      `came_from_user?` is undefined (i.e. except Active Record).
      
      Fixes #33651.
      Fixes #33686.
      47a6d788
  4. 12 8月, 2018 1 次提交
  5. 08 7月, 2018 1 次提交
  6. 12 6月, 2018 1 次提交
  7. 14 3月, 2018 1 次提交
  8. 28 2月, 2018 1 次提交
  9. 18 2月, 2018 1 次提交
  10. 31 1月, 2018 1 次提交
  11. 24 1月, 2018 1 次提交
    • S
      Allow attributes with a proc default to be marshalled · 0af36c62
      Sean Griffin 提交于
      We don't implement much custom marshalling logic for these objects, but
      the proc default case needs to be handled separately. Unfortunately
      there's no way to just say "do what you would have done but with this
      value for one ivar", so we have to manually implement `marshal_load` as
      well.
      
      The test case is a little bit funky, but I'd really like an equality
      test in there, and there's no easy way to add one now that this is out
      of AR (since the `attributes` method isn't here)
      
      Fixes #31216
      0af36c62
  12. 19 12月, 2017 1 次提交
    • Y
      Fix validation callbacks on multiple context · 470d0e45
      Yoshiyuki Hirano 提交于
      I found a bug that validation callbacks don't fire on multiple context.
      So I've fixed it.
      
      Example:
      
      ```ruby
      class Dog
        include ActiveModel::Validations
        include ActiveModel::Validations::Callbacks
      
        attr_accessor :history
      
        def initialize
          @history = []
        end
      
        before_validation :set_before_validation_on_a, on: :a
        before_validation :set_before_validation_on_b, on: :b
        after_validation :set_after_validation_on_a, on: :a
        after_validation :set_after_validation_on_b, on: :b
      
        def set_before_validation_on_a; history << "before_validation on a"; end
        def set_before_validation_on_b; history << "before_validation on b"; end
        def set_after_validation_on_a;  history << "after_validation on a" ; end
        def set_after_validation_on_b;  history << "after_validation on b" ; end
      end
      ```
      
      Before:
      
      ```
      d = Dog.new
      d.valid?([:a, :b])
      d.history # []
      ```
      
      After:
      
      ```
      d = Dog.new
      d.valid?([:a, :b])
      d.history # ["before_validation on a", "before_validation on b", "after_validation on a", "after_validation on b"]
      ```
      470d0e45
  13. 29 11月, 2017 1 次提交
  14. 28 11月, 2017 1 次提交
  15. 06 11月, 2017 1 次提交
  16. 26 10月, 2017 1 次提交
  17. 08 7月, 2017 1 次提交
    • J
      Add ActiveModel::Errors#merge! · 3650ca98
      Jahfer Husain 提交于
      ActiveModel::Errors#merge! allows ActiveModel::Errors to append errors from
      a separate ActiveModel::Errors instance onto their own.
      
      Example:
      
          person = Person.new
          person.errors.add(:name, :blank)
      
          errors = ActiveModel::Errors.new(Person.new)
          errors.add(:name, :invalid)
      
          person.errors.merge!(errors)
          puts person.errors.messages
          # => { name: ["can't be blank", "is invalid"] }
      3650ca98
  18. 28 6月, 2017 1 次提交
  19. 27 5月, 2017 1 次提交
  20. 30 4月, 2017 1 次提交
  21. 29 3月, 2017 1 次提交
  22. 28 3月, 2017 1 次提交
    • B
      Fix ActiveModel::Errors #keys, #values · 01269aed
      bogdanvlviv 提交于
      Before:
        person.errors.keys    # => []
        person.errors.values  # => []
        person.errors[:name]  # => []
        person.errors.keys    # => [:name]
        person.errors.values  # => [[]]
      
      After:
        person.errors.keys   # => []
        person.errors.values # => []
        person.errors[:name] # => []
        person.errors.keys   # => []
        person.errors.values # => []
      
      Related to #23468
      01269aed
  23. 22 3月, 2017 1 次提交
  24. 04 3月, 2017 1 次提交
  25. 24 2月, 2017 1 次提交
  26. 18 2月, 2017 1 次提交
  27. 07 2月, 2017 2 次提交
  28. 22 11月, 2016 1 次提交
  29. 15 10月, 2016 1 次提交
  30. 12 10月, 2016 2 次提交
    • U
      Remove method for regenerating a token, and update `#authenticate`. · 9b63bf1d
      Unathi Chonco 提交于
      This change now creates a method `#authenticate_XXX` where XXX is
      the configured attribute name on `#has_secure_password`. `#authenticate`
      is now an alias to this method when the attribute name is the default
      'password'
      9b63bf1d
    • U
      This addition will now allow configuring an attribute name for the · 86a48b4d
      Unathi Chonco 提交于
      existing `#has_secure_password`. This can be useful when one would
      like to store some secure field as a digest, just like a password.
      
      The method still defaults to `password`. It now also allows using the
      same `#authenticate` method which now accepts a second argument for
      specifying the attribute to be authenticated, or will default to 'password`.
      
      A new method is also added for generating a new token for an attribute by
      calling `#regenerate_XXXX` where `XXXX` is the attribute name.
      86a48b4d
  31. 11 10月, 2016 2 次提交
  32. 10 5月, 2016 1 次提交
  33. 07 5月, 2016 1 次提交
  34. 06 5月, 2016 1 次提交
  35. 28 4月, 2016 1 次提交
  36. 05 4月, 2016 1 次提交
  37. 25 2月, 2016 1 次提交