1. 31 1月, 2017 1 次提交
  2. 04 1月, 2017 1 次提交
  3. 30 12月, 2016 1 次提交
  4. 29 12月, 2016 1 次提交
  5. 24 12月, 2016 1 次提交
  6. 06 12月, 2016 1 次提交
  7. 24 11月, 2016 1 次提交
    • D
      Restore RecordNotFound when *_ids= can't find records by ID · 15e2da65
      Dominic Cleal 提交于
      9c9fb19b changed the behaviour of the _ids= setters for associations to
      raise an AssociationTypeMismatch when unknown IDs are given:
      
          Class: <ActiveRecord::AssociationTypeMismatch>
          Message: <"Developer(#43811860) expected, got NilClass(#16732720)">
      
      This restores the original ActiveRecord::RecordNotFound exception with a
      much clearer error message:
      
          Class: <ActiveRecord::RecordNotFound>
          Message: <"Couldn't find all Developers with 'id': (1, -9999) [WHERE \"contracts\".\"company_id\" = ?] (found 1 results, but was looking for 2)">
      
      Fixes #25719
      15e2da65
  8. 09 11月, 2016 1 次提交
    • R
      Should except `:distinct` rather than `:order` for `exists?` · 2bf7c300
      Ryuta Kamizono 提交于
      Records fetching order is very important for performance if `limit` is
      presented. Should not except the order in the case.
      
      And `exists?` replaces select list to `1 AS one` therefore `:distinct`
      is useless (`DISTINCT 1 AS one`). And PostgreSQL raises the following
      error if `:distinct` and `:order` are used in the same time.
      
      ```
      ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
      ```
      2bf7c300
  9. 23 9月, 2016 1 次提交
  10. 03 9月, 2016 1 次提交
  11. 18 8月, 2016 1 次提交
  12. 16 8月, 2016 2 次提交
  13. 15 8月, 2016 1 次提交
  14. 14 8月, 2016 1 次提交
  15. 08 8月, 2016 1 次提交
  16. 07 8月, 2016 2 次提交
  17. 28 7月, 2016 1 次提交
  18. 16 6月, 2016 1 次提交
    • R
      Prevent `RangeError` for `FinderMethods#exists?` · 1cf467b7
      Ryuta Kamizono 提交于
      `FinderMethods#exists?` should return a boolean rather than raising an
      exception.
      
      `UniquenessValidator#build_relation` catches a `RangeError` because it
      includes type casting due to a string value truncation. But a string
      value truncation was removed at #23523 then type casting in
      `build_relation` is no longer necessary. aa062318 removes type casting in
      `build_relation` then a `RangeError` moves to `relation.exists?`.
      
      This change will remove the catching a `RangeError`.
      1cf467b7
  19. 13 6月, 2016 1 次提交
  20. 31 5月, 2016 1 次提交
    • S
      Exists shouldn't error when used with `includes` · 02da8aea
      Sean Griffin 提交于
      Currently `exists?` does some hackery where it assumes that we can join
      onto anything that we passed to `eager_load` or `includes`, which
      doesn't work if we are joining onto a polymorphic association.
      
      Actually figuring out if we want to include something would require
      knowledge deep within the join dependency module, which is hard to pull
      up. The simplest solution is just to pass a flag down that says we're
      not actually going to try to eager load any of the data. It's not the
      solution I'd like, but that code really needs to be untangled before we
      can do much with it.
      
      This is another attempt at 6d5b1fdf which should address the concerns
      that led to reverting it in 4ecabed2.
      02da8aea
  21. 12 4月, 2016 1 次提交
  22. 14 3月, 2016 1 次提交
  23. 28 2月, 2016 3 次提交
  24. 21 2月, 2016 1 次提交
  25. 14 2月, 2016 1 次提交
  26. 13 2月, 2016 2 次提交
  27. 11 2月, 2016 2 次提交
    • Y
      remove warnings from FinderMethods · 424b2019
      yuuji.yaginuma 提交于
      This removes the following warnings.
      
      ```
      activerecord/lib/active_record/relation/finder_methods.rb:252: warning: ambiguous first argument; put parentheses or a space even after `-' operator
      activerecord/lib/active_record/relation/finder_methods.rb:258: warning: ambiguous first argument; put parentheses or a space even after `-' operator
      activerecord/lib/active_record/relation/finder_methods.rb:268: warning: ambiguous first argument; put parentheses or a space even after `-' operator
      activerecord/lib/active_record/relation/finder_methods.rb:274: warning: ambiguous first argument; put parentheses or a space even after `-' operator
      ```
      424b2019
    • B
      rename to 'second_to_last' and 'third_to_last' · e8aeda2a
      Brian Christian 提交于
      e8aeda2a
  28. 10 2月, 2016 1 次提交
  29. 04 2月, 2016 2 次提交
  30. 02 2月, 2016 1 次提交
  31. 28 1月, 2016 2 次提交
  32. 25 12月, 2015 1 次提交
    • B
      Fix `first(limit)` to take advantage of `loaded?` records if available · b42c3255
      Ben Woosley 提交于
      I realized that `first(2)`, etc. was unnecessarily querying for the
      records when they were already preloaded. This was because
      `find_nth_with_limit` can not know which `@records` to return because
      it conflates the `offset` and `index` into a single variable, while
      the `@records` only needs the `index` itself to select the proper
      record.
      
      Because `find_nth` and `find_nth_with_limit` are public methods, I
      instead introduced a private method `find_nth_with_limit_and_offset`
      which is called internally and handles the `loaded?` checking.
      
      Once the `offset` argument is removed from `find_nth`,
      `find_nth_with_limit_and_offset` can be collapsed into
      `find_nth_with_limit`, with `offset` always equal to `offset_index`.
      b42c3255