1. 14 3月, 2018 1 次提交
  2. 28 2月, 2018 1 次提交
  3. 18 2月, 2018 1 次提交
  4. 31 1月, 2018 1 次提交
  5. 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
  6. 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
  7. 29 11月, 2017 1 次提交
  8. 28 11月, 2017 1 次提交
  9. 06 11月, 2017 1 次提交
  10. 26 10月, 2017 1 次提交
  11. 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
  12. 28 6月, 2017 1 次提交
  13. 27 5月, 2017 1 次提交
  14. 30 4月, 2017 1 次提交
  15. 29 3月, 2017 1 次提交
  16. 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
  17. 22 3月, 2017 1 次提交
  18. 04 3月, 2017 1 次提交
  19. 24 2月, 2017 1 次提交
  20. 18 2月, 2017 1 次提交
  21. 07 2月, 2017 2 次提交
  22. 22 11月, 2016 1 次提交
  23. 15 10月, 2016 1 次提交
  24. 11 10月, 2016 2 次提交
  25. 10 5月, 2016 1 次提交
  26. 07 5月, 2016 1 次提交
  27. 06 5月, 2016 1 次提交
  28. 28 4月, 2016 1 次提交
  29. 05 4月, 2016 1 次提交
  30. 25 2月, 2016 1 次提交
  31. 02 2月, 2016 1 次提交
  32. 06 1月, 2016 1 次提交
  33. 05 1月, 2016 1 次提交
  34. 21 12月, 2015 2 次提交
  35. 19 12月, 2015 1 次提交
  36. 02 10月, 2015 1 次提交
  37. 09 9月, 2015 1 次提交