1. 09 11月, 2017 2 次提交
  2. 13 8月, 2017 1 次提交
  3. 20 7月, 2017 1 次提交
  4. 02 7月, 2017 1 次提交
  5. 01 7月, 2017 1 次提交
  6. 01 6月, 2017 1 次提交
  7. 19 3月, 2017 1 次提交
    • R
      Use `load` rather than `collect` for force loading · 59db5f22
      Ryuta Kamizono 提交于
      Since b644964b `ActiveRecord::Relation` includes `Enumerable` so
      delegating `collect`, `all?`, and `include?` are also unneeded.
      `collect` without block returns `Enumerable` without preloading by that.
      We should use `load` rather than `collect` for force loading.
      59db5f22
  8. 25 2月, 2017 1 次提交
  9. 29 10月, 2016 1 次提交
  10. 17 9月, 2016 1 次提交
  11. 16 8月, 2016 1 次提交
  12. 07 8月, 2016 3 次提交
  13. 19 7月, 2016 1 次提交
    • S
      Fix the calling `merge` method at first in a scope · cf2574b1
      suginoy 提交于
      Changing the order of method chaining `merge` and other query
      method such as `joins` should produce the same result.
      
      ```ruby
      class Topic < ApplicationRecord
        scope :safe_chaininig,   -> { joins(:comments).merge(Comment.newest) }
        scope :unsafe_chaininig, -> { merge(Comment.newest).joins(:comments) } #=> NoMethodError
      end
      ```
      cf2574b1
  14. 05 5月, 2016 1 次提交
  15. 03 5月, 2016 1 次提交
    • S
      Do not delegate `AR::Base#empty?` to `all` · 98264a13
      Sean Griffin 提交于
      Unlike `one?` and `none?`, `empty?` has interactions with methods
      outside of enumerable. It also doesn't fit in the same vein.
      `Topic.any?` makes sense. `Topic.empty?` does not, as `Topic` is not a
      container.
      
      Fixes #24808
      Close #24812
      98264a13
  16. 29 3月, 2016 1 次提交
  17. 28 1月, 2016 3 次提交
  18. 26 8月, 2015 1 次提交
  19. 21 2月, 2015 1 次提交
    • F
      Error message testing fix · b1d26350
      Franky W 提交于
      The testing of error messages have been implemented wrongly a few times.
      This is an attempt to fix it.
      
      For example, some of these test should have failed with the new code.
      The reason they are not failling with the new string is the fact they
      were not being tested beforehand.
      b1d26350
  20. 28 1月, 2015 1 次提交
    • S
      `WhereClause#predicates` does not need to be public · d26dd008
      Sean Griffin 提交于
      The only place it was accessed was in tests. Many of them have another
      way that they can test their behavior, that doesn't involve reaching
      into internals as far as they did. `AssociationScopeTest` is testing a
      situation where the where clause would have one bind param per
      predicate, so it can just ignore the predicates entirely. The where
      chain test was primarly duplicating the logic tested on `WhereClause`
      directly, so I instead just make sure it calls the appropriate method
      which is fully tested in isolation.
      d26dd008
  21. 26 1月, 2015 1 次提交
  22. 14 11月, 2014 1 次提交
  23. 24 10月, 2014 1 次提交
  24. 04 9月, 2014 1 次提交
    • G
      Enums shouldn't ruin people's anniversaries · 94b7328b
      Godfrey Chan 提交于
      Added a few more methods on Module/Class to the dangerous class methods
      blacklist. (Technically, allocate and new are already protected currently because
      we happen to redefine them in the current implantation.)
      
      Closes #16792
      94b7328b
  25. 21 5月, 2014 1 次提交
  26. 24 4月, 2014 1 次提交
    • J
      Fixes Issue #13466. · 9c3afdc3
      Jefferson Lai 提交于
      Changed the call to a scope block to be evaluated with instance_eval.
      The result is that ScopeRegistry can use the actual class instead of base_class when
      caching scopes so queries made by classes with a common ancestor won't leak scopes.
      9c3afdc3
  27. 04 4月, 2014 1 次提交
  28. 02 2月, 2014 1 次提交
  29. 30 1月, 2014 1 次提交
    • G
      `scope` now raises on "dangerous" name conflicts · 7e8e91c4
      Godfrey Chan 提交于
      Similar to dangerous attribute methods, a scope name conflict is
      dangerous if it conflicts with an existing class method defined within
      `ActiveRecord::Base` but not its ancestors.
      
      See also #13389.
      
      *Godfrey Chan*, *Philippe Creux*
      7e8e91c4
  30. 21 1月, 2014 1 次提交
    • J
      Ensure #second acts like #first AR finder · cafe31a0
      Jason Meller 提交于
      This commit bring the famous ordinal Array instance methods defined
      in ActiveSupport into ActiveRecord as fully-fledged finders.
      
      These finders ensure a default ascending order of the table's primary
      key, and utilize the OFFSET SQL verb to locate the user's desired
      record. If an offset is defined in the query, calling #second adds
      to the offset to get the actual desired record.
      
      Fixes #13743.
      cafe31a0
  31. 04 7月, 2013 1 次提交
  32. 02 7月, 2013 1 次提交
  33. 29 6月, 2013 1 次提交
  34. 05 4月, 2013 2 次提交
    • J
      Fix scope chaining + STI · 8606a7fb
      Jon Leighton 提交于
      See #9869 and #9929.
      
      The problem arises from the following example:
      
          class Project < ActiveRecord::Base
            scope :completed, -> { where completed: true }
          end
      
          class MajorProject < Project
          end
      
      When calling:
      
          MajorProject.where(tasks_count: 10).completed
      
      This expands to:
      
          MajorProject.where(tasks_count: 10).scoping {
            MajorProject.completed
          }
      
      However the lambda for the `completed` scope is defined on Project. This
      means that when it is called, `self` is Project rather than
      MajorProject. So it expands to:
      
          MajorProject.where(tasks_count: 10).scoping {
            Project.where(completed: true)
          }
      
      Since the scoping was applied on MajorProject, and not Project, this
      fails to apply the tasks_count condition.
      
      The solution is to make scoping apply across STI classes. I am slightly
      concerned about the possible side-effects of this, but no tests fail and
      it seems ok. I guess we'll see.
      8606a7fb
    • N
      failing test for #9869 · f029fb07
      Neeraj Singh 提交于
      f029fb07