1. 17 9月, 2012 1 次提交
    • S
      Don't preserve SELECT columns on COUNT · 9fa3f102
      Steve Klabnik 提交于
      The COUNT clause of a finder_sql relationship is being rewritten from
      COUNT(*) to COUNT(table_name.*). This does not appear to be valid syntax
      in MySQL:
      
      ```
      mysql> SELECT COUNT( table_name.* ) FROM `table_name`;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the
      manual that corresponds to your MySQL server version for the right
      syntax to use near '* ) FROM `table_name`' at line 1
      ```
      
      This fixes the bug, as well as adding tests so we don't re-introduce
      it in the future.
      
      Fixes #3956.
      9fa3f102
  2. 11 8月, 2012 1 次提交
    • J
      Remove the dependent_restrict_raises option. · 5ad79989
      Jon Leighton 提交于
      It's not really a good idea to have this as a global config option. We
      should allow people to specify the behaviour per association.
      
      There will now be two new values:
      
      * :dependent => :restrict_with_exception implements the current
        behaviour of :restrict. :restrict itself is deprecated in favour of
        :restrict_with_exception.
      * :dependent => :restrict_with_error implements the new behaviour - it
        adds an error to the owner if there are dependent records present
      
      See #4727 for the original discussion of this.
      5ad79989
  3. 03 8月, 2012 1 次提交
    • J
      Remove ActiveRecord::Base.to_a · 55b24888
      Jon Leighton 提交于
      On reflection, it seems like a bit of a weird method to have on
      ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
      55b24888
  4. 02 8月, 2012 2 次提交
  5. 31 7月, 2012 1 次提交
  6. 28 7月, 2012 1 次提交
  7. 27 7月, 2012 1 次提交
    • J
      ActiveRecord::Base.all returns a Relation. · 6a81ccd6
      Jon Leighton 提交于
      Previously it returned an Array.
      
      If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This
      is more explicit.
      
      In most cases this should not break existing code, since
      Relations use method_missing to delegate unknown methods to #to_a
      anyway.
      6a81ccd6
  8. 25 7月, 2012 1 次提交
  9. 21 7月, 2012 2 次提交
  10. 18 7月, 2012 1 次提交
  11. 13 7月, 2012 1 次提交
  12. 30 6月, 2012 1 次提交
  13. 12 6月, 2012 1 次提交
  14. 29 5月, 2012 1 次提交
    • F
      Add support for CollectionAssociation#delete by Fixnum or String · 39f06984
      Francesco Rodriguez 提交于
      I found the next issue between CollectionAssociation `delete`
      and `destroy`.
      
          class Person < ActiveRecord::Base
            has_many :pets
          end
      
          person.pets.destroy(1)
          # => OK, returns the destroyed object
      
          person.pets.destroy("2")
          # => OK, returns the destroyed object
      
          person.pets.delete(1)
          # => ActiveRecord::AssociationTypeMismatch
      
          person.pets.delete("2")
          # => ActiveRecord::AssociationTypeMismatch
      
      Adding support for deleting with a fixnum or string like
      `destroy` method.
      39f06984
  15. 26 5月, 2012 1 次提交
    • P
      Make connection pool fair with respect to waiting threads. · 02b23355
      Patrick Mahoney 提交于
      The core of this fix is a threadsafe, fair Queue class.  It is
      very similar to Queue in stdlib except that it supports waiting
      with a timeout.
      
      The issue this solves is that if several threads are contending for
      database connections, an unfair queue makes is possible that a thread
      will timeout even while other threads successfully acquire and release
      connections.  A fair queue means the thread that has been waiting the
      longest will get the next available connection.
      
      This includes a few test fixes to avoid test ordering issues that
      cropped up during development of this patch.
      02b23355
  16. 19 5月, 2012 2 次提交
  17. 18 5月, 2012 1 次提交
  18. 17 5月, 2012 1 次提交
  19. 12 5月, 2012 2 次提交
    • J
      Remove #=== quirk · 2091e5a6
      Jon Leighton 提交于
      Makes it consistent with Relation. Can't see a use for this.
      2091e5a6
    • J
      CollectionProxy < Relation · c86a32d7
      Jon Leighton 提交于
      This helps bring the interfaces of CollectionProxy and Relation closer
      together, and reduces the delegation backflips we need to perform.
      
      For example, first_or_create is defined thus:
      
      class ActiveRecord::Relation
        def first_or_create(...)
          first || create(...)
        end
      end
      
      If CollectionProxy < Relation, then post.comments.first_or_create will
      hit the association's #create method which will actually add the new record
      to the association, just as post.comments.create would.
      
      With the previous delegation, post.comments.first_or_create expands to
      post.comments.scoped.first_or_create, where post.comments.scoped has no
      knowledge of the association.
      c86a32d7
  20. 03 5月, 2012 1 次提交
  21. 27 4月, 2012 8 次提交
  22. 09 3月, 2012 1 次提交
  23. 06 3月, 2012 1 次提交
  24. 02 2月, 2012 1 次提交
  25. 01 2月, 2012 2 次提交
  26. 31 1月, 2012 2 次提交
  27. 29 1月, 2012 1 次提交