1. 15 12月, 2015 8 次提交
  2. 14 12月, 2015 2 次提交
    • S
      Use a bind param for `LIMIT` and `OFFSET` · 574f2556
      Sean Griffin 提交于
      We currently generate an unbounded number of prepared statements when
      `limit` or `offset` are called with a dynamic argument. This changes
      `LIMIT` and `OFFSET` to use bind params, eliminating the problem.
      
      `Type::Value#hash` needed to be implemented, as it turns out we busted
      the query cache if the type object used wasn't exactly the same object.
      
      This drops support for passing an `Arel::Nodes::SqlLiteral` to `limit`.
      Doing this relied on AR internals, and was never officially supported
      usage.
      
      Fixes #22250.
      574f2556
    • S
      Deprecate limit strings with commas · 4358b0d1
      Sean Griffin 提交于
      Some backends allow `LIMIT 1,2` as a shorthand for `LIMIT 1 OFFSET 2`.
      Supporting this in Active Record massively complicates using bind
      parameters for limit and offset, and it's trivially easy to build an
      invalid SQL query by also calling `offset` on the same `Relation`.
      
      This is a niche syntax that is only supported by a few adapters, and can
      be trivially worked around by calling offset explicitly.
      4358b0d1
  3. 13 12月, 2015 1 次提交
  4. 12 12月, 2015 1 次提交
  5. 07 12月, 2015 4 次提交
    • Y
      Typo correction · bcf89f44
      Yves Siegrist 提交于
      In the doc the `dependent` option was set with: `dependent: destroy`.
      This is not working because destroy would call the method of the activerecord::base object.
      
      The right way is: `dependent: :destroy`
      bcf89f44
    • A
      Make sure we touch all the parents when touch_later. · e7c48db5
      Arthur Neves 提交于
      The problem was that when saving an object, we would
      call touch_later on the parent which wont be saved immediteally, and
      it wont call any callbacks. That was working one level up because
      we were calling touch, during the touch_later commit phase. However that still
      didnt solve the problem when you have a 3+ levels of parents to be touched,
      as calling touch would affect the parent, but it would be too late to run callbacks
      on its grand-parent.
      
      The solution for this, is instead, call touch_later upwards when the first
      touch_later is called. So we make sure all the timestamps are updated without relying
      on callbacks.
      
      This also removed the hard dependency BelongsTo builder had with the TouchLater module.
      So we can still have the old behaviour if TouchLater module is not included.
      
      [fixes 5f5e6d92]
      [related #19324]
      e7c48db5
    • G
      Introduce after_{create,update,delete}_commit callbacks · 5a300b2e
      Genadi Samokovarov 提交于
      Those are actually shortcuts for `after_commit`.
      
      Before:
      
          after_commit :add_to_index_later, on: :create
          after_commit :update_in_index_later, on: :update
          after_commit :remove_from_index_later, on: :destroy
      
      After:
      
          after_create_commit  :add_to_index_later
          after_update_commit  :update_in_index_later
          after_destroy_commit :remove_from_index_later
      5a300b2e
    • E
      [ci skip] Add a dollar sign to each command in the READMEs · 6bd417df
      Elektron1c97 提交于
      According to pr #22443 in the guides there's always a dollar sign before every command, so why is in the main README a `$` and in every submodule a `%`?
      
      Just eye candy..
      6bd417df
  6. 06 12月, 2015 1 次提交
  7. 05 12月, 2015 2 次提交
  8. 03 12月, 2015 2 次提交
  9. 02 12月, 2015 4 次提交
  10. 01 12月, 2015 4 次提交
  11. 30 11月, 2015 2 次提交
  12. 29 11月, 2015 1 次提交
  13. 27 11月, 2015 1 次提交
  14. 26 11月, 2015 2 次提交
  15. 24 11月, 2015 5 次提交