1. 28 2月, 2015 1 次提交
  2. 26 2月, 2015 1 次提交
    • R
      Follow-up to #10776 · 95c2fc96
      Robin Dupret 提交于
      The name `ActiveModel::AttributeAssignment::UnknownAttributeError` is
      too implementation specific so let's move the constant directly under
      the ActiveModel namespace.
      
      Also since this constant used to be under the ActiveRecord namespace, to
      make the upgrade path easier, let's avoid raising the former constant
      when we deal with this error on the Active Record side.
      95c2fc96
  3. 25 2月, 2015 1 次提交
    • I
      activemodel: make .model_name json encodable · c5d62cb8
      Ian Ker-Seymer 提交于
      Previously, calling `User.model_name.to_json` would result in an infinite
      recursion as `.model_name` inherited its `.as_json` behavior from Object. This
      patch fixes that unexpected behavior by delegating `.as_json` to :name.
      c5d62cb8
  4. 21 2月, 2015 2 次提交
  5. 20 2月, 2015 1 次提交
  6. 19 2月, 2015 1 次提交
  7. 16 2月, 2015 1 次提交
  8. 06 2月, 2015 3 次提交
  9. 03 2月, 2015 2 次提交
  10. 02 2月, 2015 1 次提交
    • E
      Fix validations on child record when record parent has validate: false · 27aa4dda
      eileencodes 提交于
      Fixes #17621. This 5 year old (or older) issue causes validations to fire
      when a parent record has `validate: false` option and a child record is
      saved. It's not the responsibility of the model to validate an
      associated object unless the object was created or modified by the
      parent.
      
      Clean up tests related to validations
      
      `assert_nothing_raised` is not benefiting us in these tests
      Corrected spelling of "respects"
      It's better to use `assert_not_operator` over `assert !r.valid`
      27aa4dda
  11. 01 2月, 2015 3 次提交
  12. 31 1月, 2015 1 次提交
  13. 28 1月, 2015 1 次提交
  14. 24 1月, 2015 4 次提交
  15. 21 1月, 2015 2 次提交
  16. 19 1月, 2015 1 次提交
    • S
      Don't calculate in-place changes on attribute assignment · ea721d70
      Sean Griffin 提交于
      When an attribute is assigned, we determine if it was already marked as
      changed so we can determine if we need to clear the changes, or mark it
      as changed. Since this only affects the `attributes_changed_by_setter`
      hash, in-place changes are irrelevant to this process. Since calculating
      in-place changes can be expensive, we can just skip it here.
      
      I also added a test for the only edge case I could think of that would
      be affected by this change.
      ea721d70
  17. 12 1月, 2015 1 次提交
  18. 11 1月, 2015 1 次提交
  19. 10 1月, 2015 1 次提交
  20. 08 1月, 2015 1 次提交
    • C
      Better docs for AM::Lint::Tests · 76dc58b4
      claudiob 提交于
      This commit changes the original documentation of ActiveModel::Lint::Tests
      introduced in dbf20c2d to focus less on *why* the tests exist and more on
      *what* the tests do.
      
      For instance, `test_to_key` was documented as:
      
      > Returns an Enumerable of all (primary) key attributes...
      
      whereas `test_to_key` is simply a test meant to *fail* or *pass*, and the
      documentation above refers to `to_key`.
      
      [ci skip]
      76dc58b4
  21. 06 1月, 2015 1 次提交
  22. 04 1月, 2015 2 次提交
  23. 03 1月, 2015 4 次提交
    • C
      Deprecate `false` as the way to halt AM callbacks · 91b81293
      claudiob 提交于
      Before this commit, returning `false` in an ActiveModel `before_` callback
      such as `before_create` would halt the callback chain.
      
      After this commit, the behavior is deprecated: will still work until
      the next release of Rails but will also display a deprecation warning.
      
      The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
      91b81293
    • C
      Deprecate `false` as the way to halt AM validation callbacks · f7679812
      claudiob 提交于
      Before this commit, returning `false` in an ActiveModel validation
      callback such as `before_validation` would halt the callback chain.
      
      After this commit, the behavior is deprecated: will still work until
      the next release of Rails but will also display a deprecation warning.
      
      The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
      f7679812
    • C
      Throw :abort halts default CallbackChains · 2386daab
      claudiob 提交于
      This commit changes arguments and default value of CallbackChain's :terminator
      option.
      
      After this commit, Chains of callbacks defined **without** an explicit
      `:terminator` option will be halted as soon as a `before_` callback throws
      `:abort`.
      
      Chains of callbacks defined **with** a `:terminator` option will maintain their
      existing behavior of halting as soon as a `before_` callback matches the
      terminator's expectation. For instance, ActiveModel's callbacks will still
      halt the chain when a `before_` callback returns `false`.
      2386daab
    • C
      Use Active Model, not ActiveModel in plain English · 7cc145ec
      claudiob 提交于
      Also prevents the word "Model" from linking to the documentation
      of ActiveModel::Model because that's not intended.
      
      [ci skip]
      7cc145ec
  24. 30 12月, 2014 1 次提交
  25. 23 12月, 2014 1 次提交
  26. 22 12月, 2014 1 次提交