1. 01 9月, 2017 1 次提交
    • M
      Clarify intentions around method redefinitions · 2e6658ae
      Matthew Draper 提交于
      Don't use remove_method or remove_possible_method just before a new
      definition: at best the purpose is unclear, and at worst it creates a
      race condition.
      
      Instead, prefer redefine_method when practical, and
      silence_redefinition_of_method otherwise.
      2e6658ae
  2. 20 7月, 2017 1 次提交
  3. 02 7月, 2017 1 次提交
  4. 01 7月, 2017 1 次提交
  5. 30 5月, 2017 1 次提交
  6. 23 5月, 2017 1 次提交
  7. 05 1月, 2017 1 次提交
  8. 14 9月, 2016 1 次提交
  9. 06 9月, 2016 1 次提交
  10. 03 9月, 2016 1 次提交
  11. 16 8月, 2016 1 次提交
  12. 08 8月, 2016 1 次提交
    • X
      code gardening: removes redundant selfs · a9dc4545
      Xavier Noria 提交于
      A few have been left for aesthetic reasons, but have made a pass
      and removed most of them.
      
      Note that if the method `foo` returns an array, `foo << 1`
      is a regular push, nothing to do with assignments, so
      no self required.
      a9dc4545
  13. 07 8月, 2016 4 次提交
  14. 24 2月, 2016 1 次提交
  15. 23 2月, 2016 1 次提交
    • Y
      [ci skip] Fix `'id'` to be fixed-width font · c5b36a3e
      yui-knk 提交于
      As shown below, we should use <tt>...</tt> for string literal
      
      ```
      $ echo "+'id'+" | rdoc --pipe
      <p>+&#39;id&#39;+</p>
      
      $ echo "<tt>'id'</tt>" | rdoc --pipe
      <p><code>&#39;id&#39;</code></p>
      ```
      c5b36a3e
  16. 23 1月, 2016 1 次提交
    • A
      Don't short-circuit reject_if proc · 0fde6f55
      Andrew White 提交于
      When updating an associated record via nested attribute hashes the
      reject_if proc could be bypassed if the _destroy flag was set in the
      attribute hash and allow_destroy was set to false.
      
      The fix is to only short-circuit if the _destroy flag is set and the
      option allow_destroy is set to true. It also fixes an issue where
      a new record wasn't created if _destroy was set and the option
      allow_destroy was set to false.
      
      CVE-2015-7577
      0fde6f55
  17. 21 7月, 2015 1 次提交
    • S
      Extra caller details added to ActiveRecord::RecordNotFound · d763956e
      Sameer Rahmani 提交于
      ActiveRecord::RecordNotFound modified to store model name, primary_key
      and id of the caller model. It allows the catcher of this exception to make
      a better decision to what to do with it. For example consider this simple
      example:
      
          class SomeAbstractController < ActionController::Base
            rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404
      
            private def redirect_to_404(e)
              return redirect_to(posts_url) if e.model == 'Post'
              raise
            end
          end
      d763956e
  18. 18 7月, 2015 2 次提交
    • T
    • S
      Ensure that `ActionController::Parameters` can still be passed to AR · 68af6361
      Sean Griffin 提交于
      Since nested hashes are also instances of
      `ActionController::Parameters`, and we're explicitly looking to work
      with a hash for nested attributes, this caused breakage in several
      points.
      
      This is the minimum viable fix for the issue (and one that I'm not
      terribly fond of). I can't think of a better place to handle this at the
      moment. I'd prefer to use some sort of solution that doesn't special
      case AC::Parameters, but we can't use something like `to_h` or `to_a`
      since `Enumerable` adds both.
      
      While I've added a trivial test case for verifying this fix in
      isolation, we really need better integration coverage to prevent
      regressions like this in the future. We don't actually have a lot of
      great places for integration coverage at the moment, so I'm deferring it
      for now.
      
      Fixes #20922.
      68af6361
  19. 22 5月, 2015 1 次提交
  20. 18 5月, 2015 1 次提交
  21. 28 4月, 2015 1 次提交
  22. 18 2月, 2015 1 次提交
  23. 30 1月, 2015 1 次提交
  24. 29 1月, 2015 1 次提交
  25. 03 1月, 2015 1 次提交
  26. 23 12月, 2014 1 次提交
    • G
      Add information about "allow_destroy" requiring an ID. [ci skip] · 7476b90e
      George Millo 提交于
      I just wasted an absurd amount of time trying to figure out why my model
      wasn't being deleted even though I was setting `_destroy` to true like
      the instructions said. Making the documentation a little bit clear so
      that someone like me doesn't waste their time in future.
      7476b90e
  27. 10 6月, 2014 1 次提交
    • S
      Rename `type_cast` to `type_cast_from_database` · d24e6407
      Sean Griffin 提交于
      In some cases there is a difference between the two, we should always
      be doing one or the other. For convenience, `type_cast` is still a
      private method on type, so new types that do not need different behavior
      don't need to implement two methods, but it has been moved to private so
      it cannot be used accidentally.
      d24e6407
  28. 28 5月, 2014 1 次提交
  29. 27 5月, 2014 1 次提交
    • A
      Refactoring .reflections public method. · 00b02421
      Arthur Neves 提交于
      Now the internal reflections will hold a reference to its public
      representation, so when the outside world calls `Account.reflection` we
      can build a list of public reflections.
      00b02421
  30. 25 5月, 2014 1 次提交
  31. 21 5月, 2014 1 次提交
  32. 13 4月, 2014 1 次提交
  33. 28 9月, 2013 1 次提交
  34. 12 8月, 2013 2 次提交
    • B
      Restore the use of `#add_to_target` for nested attribute updates on existing... · d35e900c
      Ben Woosley 提交于
      Restore the use of `#add_to_target` for nested attribute updates on existing records, and don't bother updating the association if the update is going to be rejected anyway.
      
      This requires adding a `skip_callbacks` argument to `#add_to_target`
      so that we don't call the callbacks multiple times in this case,
      which is functionally an application of existing association data,
      rather than an addition of a new record to the association.
      d35e900c
    • D
      Fix interactions between :before_add callbacks and nested attributes assignment · 018697de
      Dr.(USA) Joerg Schray 提交于
      Issue #1: :before_add callback is called when nested attributes assignment assigns to existing record if the association is not yet loaded
      Issue #2: Nested Attributes assignment does not affect the record in the association target when callback triggers loading of the association
      018697de
  35. 14 6月, 2013 1 次提交