1. 15 5月, 2014 1 次提交
    • N
      Make filter_binds filter out symbols that are equal to strings · 1d316ac1
      Nat Budin 提交于
      ActiveRecord::Relation::Merger's filter_binds method does not filter out bind
      variables when one of the attribute nodes has a string name, but the other has
      a symbol name, even when those names are actually equal.
      
      This can result in there being more bind variables than placeholders in the
      generated SQL.  This is particularly an issue for PostgreSQL, where this is
      treated as an error.
      
      This patch changes the filter_binds method to make it convert both attribute
      names to strings before comparing.
      1d316ac1
  2. 05 5月, 2014 1 次提交
  3. 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
  4. 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
  5. 24 1月, 2013 1 次提交
  6. 28 7月, 2012 1 次提交
  7. 27 4月, 2012 2 次提交
  8. 04 4月, 2012 1 次提交
  9. 22 3月, 2012 1 次提交
    • J
      Deprecate eager-evaluated scopes. · 0a12a5f8
      Jon Leighton 提交于
      Don't use this:
      
          scope :red, where(color: 'red')
          default_scope where(color: 'red')
      
      Use this:
      
          scope :red, -> { where(color: 'red') }
          default_scope { where(color: 'red') }
      
      The former has numerous issues. It is a common newbie gotcha to do
      the following:
      
          scope :recent, where(published_at: Time.now - 2.weeks)
      
      Or a more subtle variant:
      
          scope :recent, -> { where(published_at: Time.now - 2.weeks) }
          scope :recent_red, recent.where(color: 'red')
      
      Eager scopes are also very complex to implement within Active
      Record, and there are still bugs. For example, the following does
      not do what you expect:
      
          scope :remove_conditions, except(:where)
          where(...).remove_conditions # => still has conditions
      0a12a5f8
  10. 12 7月, 2011 1 次提交
  11. 03 6月, 2011 1 次提交
  12. 18 4月, 2011 1 次提交
  13. 13 4月, 2011 1 次提交
  14. 01 2月, 2011 1 次提交
  15. 04 1月, 2011 1 次提交
    • J
      Let AssociationCollection#find use #scoped to do its finding. Note that I am... · 3103296a
      Jon Leighton 提交于
      Let AssociationCollection#find use #scoped to do its finding. Note that I am removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
      3103296a
  16. 13 10月, 2010 1 次提交
  17. 10 10月, 2010 1 次提交
  18. 06 10月, 2010 1 次提交
    • J
      Refactoring JoinDependency and friends. This improves the code (IMO) including... · f2b41914
      Jon Leighton 提交于
      Refactoring JoinDependency and friends. This improves the code (IMO) including adding some explanatory comments, but more importantly structures it in such a way as to allow a JoinAssociation to produce an arbitrary number of actual joins, which will be necessary for nested has many through support. Also added 3 tests covering functionality which existed but was not previously covered.
      f2b41914
  19. 04 6月, 2010 1 次提交
  20. 18 1月, 2010 1 次提交
  21. 10 8月, 2009 1 次提交
  22. 24 3月, 2008 1 次提交
  23. 26 1月, 2008 1 次提交
  24. 18 1月, 2008 1 次提交
  25. 16 11月, 2005 1 次提交
    • J
      r3095@asus: jeremy | 2005-11-15 22:40:51 -0800 · 2076dca6
      Jeremy Kemper 提交于
       Ticket #1874 - Firebird adapter
       r3107@asus:  jeremy | 2005-11-16 00:06:14 -0800
       quote column aliases
       r3108@asus:  jeremy | 2005-11-16 00:08:12 -0800
       quote columns in construct_conditions_from_arguments.  update sequence_name docs.  introduce prefetched primary keys.
       r3109@asus:  jeremy | 2005-11-16 00:09:08 -0800
       double-quote rather than single-quote sqlite columns
       r3110@asus:  jeremy | 2005-11-16 00:09:56 -0800
       quote column names and use attribute_condition in validates_uniqueness_of
       r3111@asus:  jeremy | 2005-11-16 00:12:24 -0800
       Use QUOTED_TYPE constant in tests
       r3112@asus:  jeremy | 2005-11-16 00:13:28 -0800
       restrict test_inserts_with_pre_and_suffix to those adapters which support migrations
       r3113@asus:  jeremy | 2005-11-16 00:14:09 -0800
       Use QUOTED_TYPE constant in tests
       r3114@asus:  jeremy | 2005-11-16 00:14:30 -0800
       Use QUOTED_TYPE constant in tests
      
      
      git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
      2076dca6
  26. 05 11月, 2005 1 次提交
  27. 23 7月, 2005 1 次提交
  28. 03 7月, 2005 1 次提交
  29. 10 4月, 2005 1 次提交
  30. 03 4月, 2005 1 次提交