1. 15 8月, 2016 1 次提交
  2. 08 8月, 2016 1 次提交
  3. 07 8月, 2016 2 次提交
  4. 28 7月, 2016 1 次提交
  5. 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
  6. 13 6月, 2016 1 次提交
  7. 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
  8. 12 4月, 2016 1 次提交
  9. 14 3月, 2016 1 次提交
  10. 28 2月, 2016 3 次提交
  11. 21 2月, 2016 1 次提交
  12. 14 2月, 2016 1 次提交
  13. 13 2月, 2016 2 次提交
  14. 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
  15. 10 2月, 2016 1 次提交
  16. 04 2月, 2016 2 次提交
  17. 02 2月, 2016 1 次提交
  18. 28 1月, 2016 2 次提交
  19. 25 12月, 2015 2 次提交
    • 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
    • B
      Deprecate passing `offset` to `find_nth` · 16a476e4
      Ben Woosley 提交于
      All uses of the `offset` are passing `offset_index`. Better to push
      down the `offset` consideration into `find_nth`.
      
      This also works toward enabling `find_nth_with_limit` to take
      advantage of the `loaded?` state of the relation.
      16a476e4
  20. 18 12月, 2015 1 次提交
    • M
      Implement limit & offset for ourselves · 04309aee
      Matthew Draper 提交于
      We know the query will return exactly one row for each entry in the
      `ids` array, so we can do all the limit/offset calculations on that
      array, in advance.
      
      I also split our new ordered-ids behaviour out of the existing
      `find_some` method: especially with this change, the conditionals were
      overwhelming the actual logic.
      04309aee
  21. 15 12月, 2015 2 次提交
    • S
      Revert "Perform a more efficient query in `Relation#any?`" · 4ecabed2
      Sean Griffin 提交于
      This reverts commit 6d5b1fdf.
      
      `eager_load` and `references` can include hashes, which won't match up
      with `references`
      
      A test case has been added to demonstrate the problem
      4ecabed2
    • S
      Perform a more efficient query in `Relation#any?` · 6d5b1fdf
      Sean Griffin 提交于
      This was changed in 421c81bd, as `exists?` blows up if you are eager
      loading a polymorphic association, as it'll try to construct a join to
      that table. The previous change decided to execute a `count` instead,
      which wouldn't join.
      
      Of course, the only time we actually need to perform a join on the eager
      loaded values (which would perform a left outer join) is if they're
      being referenced in the where clause. This doesn't affect inner joins.
      6d5b1fdf
  22. 14 10月, 2015 1 次提交
    • Y
      applies new doc guidelines to Active Record. · 428d47ad
      Yves Senn 提交于
      The focus of this change is to make the API more accessible.
      References to method and classes should be linked to make it easy to
      navigate around.
      
      This patch makes exzessiv use of `rdoc-ref:` to provide more readable
      docs. This makes it possible to document `ActiveRecord::Base#save` even
      though the method is within a separate module
      `ActiveRecord::Persistence`. The goal here is to bring the API closer to
      the actual code that you would write.
      
      This commit only deals with Active Record. The other gems will be
      updated accordingly but in different commits. The pass through Active
      Record is not completely finished yet. A follow up commit will change
      the spots I haven't yet had the time to update.
      
      /cc @fxn
      428d47ad
  23. 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
  24. 20 6月, 2015 3 次提交
  25. 06 6月, 2015 1 次提交
  26. 04 6月, 2015 1 次提交
  27. 30 5月, 2015 1 次提交
  28. 12 5月, 2015 1 次提交
  29. 11 5月, 2015 1 次提交