1. 28 7月, 2016 1 次提交
  2. 25 7月, 2016 1 次提交
  3. 24 7月, 2016 1 次提交
  4. 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
  5. 05 5月, 2016 1 次提交
  6. 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
  7. 29 3月, 2016 1 次提交
  8. 08 3月, 2016 1 次提交
  9. 31 1月, 2016 1 次提交
  10. 28 1月, 2016 3 次提交
  11. 12 1月, 2016 2 次提交
    • M
      Skip the STI condition when evaluating a default scope · 5c6d3653
      Matthew Draper 提交于
      Given a default_scope on a parent of the current class, where that
      parent is not the base class, the parent's STI condition would become
      attached to the evaluated default scope, and then override the child's
      own STI condition.
      
      Instead, we can treat the STI condition as though it is a default scope,
      and skip it in this situation: the scope will be merged into the base
      relation, which already contains the correct STI condition.
      
      Fixes #22426.
      5c6d3653
    • M
      Active scopes apply to child classes, though not parents/siblings · 8ce0175d
      Matthew Draper 提交于
      While the commit message (and changelog example) in
      5e0b555b talked about sibling classes,
      the added test had a child ignore its parent's scoping, which seems less
      reasonable.
      8ce0175d
  12. 26 8月, 2015 1 次提交
  13. 16 4月, 2015 1 次提交
  14. 27 3月, 2015 1 次提交
  15. 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
  16. 12 2月, 2015 1 次提交
    • S
      `current_scope` shouldn't pollute sibling STI classes · 5e0b555b
      Sean Griffin 提交于
      It looks like the only reason `current_scope` was thread local on
      `base_class` instead of `self` is to ensure that when we call a named
      scope created with a proc on the parent class, it correctly uses the
      default scope of the subclass. The reason this wasn't happening was
      because the proc captured `self` as the parent class, and we're not
      actually defining a real method. Using `instance_exec` fixes the
      problem.
      
      Fixes #18806
      5e0b555b
  17. 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
  18. 26 1月, 2015 1 次提交
  19. 30 12月, 2014 1 次提交
    • S
      Remove all cases of manuallly wrapping `Arel::Nodes::Quoted` · f916aa24
      Sean Griffin 提交于
      This is no longer required now that we are injecting a type caster
      object into the Arel table, with the exception of uniqueness
      validations. Since it calls `ConnectionAdapter#type_cast`, the value has
      already been cast for the database. We don't want Arel to attempt to
      cast it further, so we need to continue wrapping it in a quoted node.
      This can potentially go away when this validator is refactored to make
      better use of `where` or the predicate builder.
      f916aa24
  20. 27 12月, 2014 1 次提交
    • S
      Inform Arel that we don't need to cast a value in tests · 8ce6fd55
      Sean Griffin 提交于
      Part of the larger refactoring to remove type casting from Arel. We can
      inform it that we already have the right type by wrapping the value in
      an `Arel::Nodes::Quoted`. This commit can be reverted when we have
      removed type casting from Arel in Rail 5.1
      8ce6fd55
  21. 02 12月, 2014 1 次提交
  22. 29 11月, 2014 1 次提交
  23. 14 11月, 2014 1 次提交
  24. 24 10月, 2014 1 次提交
  25. 15 10月, 2014 3 次提交
  26. 04 9月, 2014 2 次提交
    • S
      Skip StatementCache for eager loaded associations (Fixes #16761) · 4abbdbdf
      Sammy Larbi 提交于
      Eagerly loaded collection and singular associations are ignored by the StatementCache, which causes errors when the queries they generate reference columns that were not eagerly loaded.
      
      This commit skips the creation of the StatementCache as a fix for these scenarios.
      4abbdbdf
    • 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
  27. 14 8月, 2014 2 次提交
  28. 21 5月, 2014 1 次提交
  29. 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
  30. 04 4月, 2014 1 次提交
  31. 25 3月, 2014 1 次提交
  32. 23 2月, 2014 1 次提交
  33. 02 2月, 2014 1 次提交