1. 02 11月, 2014 1 次提交
    • S
      Use bind values for joined tables in where statements · 10f75af9
      Sean Griffin 提交于
      In practical terms, this allows serialized columns and tz aware columns
      to be used in wheres that go through joins, where they previously would
      not behave correctly. Internally, this removes 1/3 of the cases where we
      rely on Arel to perform type casting for us.
      
      There were two non-obvious changes required for this. `update_all` on
      relation was merging its bind values with arel's in the wrong order.
      Additionally, through associations were assuming there would be no bind
      parameters in the preloader (presumably because the where would always
      be part of a join)
      
      [Melanie Gilman & Sean Griffin]
      10f75af9
  2. 15 10月, 2014 1 次提交
  3. 10 5月, 2014 2 次提交
  4. 06 1月, 2014 1 次提交
    • M
      Remove method redefined warnings for test suite · bf556880
      Matthias Zirnstein 提交于
      has_many definitions with "name" as singular and as plural e.g.
        has_many :welcome_posts_with_comment
        has_many :welcome_posts_with_comments
      
      Ruby mentions it with:
      
      lib/active_record/associations/builder/collection_association.rb:65:
        warning: method redefined; discarding old welcome_posts_with_comment_ids
      lib/active_record/associations/builder/collection_association.rb:65:
        warning: previous definition of welcome_posts_with_comment_ids was here
      lib/active_record/associations/builder/collection_association.rb:75:
        warning: method redefined; discarding old welcome_posts_with_comment_ids=
      lib/active_record/associations/builder/collection_association.rb:75:
        warning: previous definition of welcome_posts_with_comment_ids= was here
      bf556880
  5. 13 9月, 2013 1 次提交
  6. 11 9月, 2013 1 次提交
  7. 18 8月, 2013 1 次提交
  8. 25 7月, 2013 1 次提交
  9. 09 7月, 2013 1 次提交
  10. 14 6月, 2013 1 次提交
    • A
      Ambiguous reflections are on :through relationships are no longer supported. · b483a0d2
      Aaron Patterson 提交于
      For example, you need to change this:
      
        class Author < ActiveRecord::Base
          has_many :posts
          has_many :taggings, :through => :posts
        end
      
        class Post < ActiveRecord::Base
          has_one :tagging
          has_many :taggings
        end
      
        class Tagging < ActiveRecord::Base
        end
      
      To this:
      
        class Author < ActiveRecord::Base
          has_many :posts
          has_many :taggings, :through => :posts, :source => :tagging
        end
      
        class Post < ActiveRecord::Base
          has_one :tagging
          has_many :taggings
        end
      
        class Tagging < ActiveRecord::Base
        end
      b483a0d2
  11. 15 3月, 2013 1 次提交
    • Y
      rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works. · a1bb6c8b
      Yves Senn 提交于
      The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our
      Relation API is close to SQL terms I renamed `#uniq` to `#distinct`.
      
      There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue
      to work. I also updated the documentation to promote the use of `#distinct`.
      a1bb6c8b
  12. 27 1月, 2013 1 次提交
    • D
      Fix cases where delete_records on a has_many association caused errors · 0a71c7b8
      Derek Kraan 提交于
      because of an ambiguous column name. This happened if the association
      model had a default scope that referenced a third table, and the third
      table also referenced the original table (with an identical
      foreign_key).
      
      Mysql requires that ambiguous columns are deambiguated by using the full
      table.column syntax. Postgresql and Sqlite use a different syntax for
      updates altogether (and don't tolerate table.name syntax), so the fix
      requires always including the full table.column and discarding it later
      for Sqlite and Postgresql.
      0a71c7b8
  13. 24 1月, 2013 1 次提交
  14. 29 11月, 2012 1 次提交
    • J
      Added STI support to init and building associations · 89b5b31c
      Jason Rush 提交于
      Allows you to do BaseClass.new(:type => "SubClass") as well as
      parent.children.build(:type => "SubClass") or parent.build_child
      to initialize an STI subclass. Ensures that the class name is a
      valid class and that it is in the ancestors of the super class
      that the association is expecting.
      89b5b31c
  15. 11 8月, 2012 1 次提交
    • J
      Use method compilation for association methods · 6e57d5c5
      Jon Leighton 提交于
      Method compilation provides better performance and I think the code
      comes out cleaner as well.
      
      A knock on effect is that methods that get redefined produce warnings. I
      think this is a good thing. I had to deal with a bunch of warnings
      coming from our tests, though.
      6e57d5c5
  16. 21 7月, 2012 1 次提交
  17. 20 7月, 2012 1 次提交
  18. 13 7月, 2012 1 次提交
  19. 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
  20. 17 1月, 2012 2 次提交
  21. 29 12月, 2011 1 次提交
  22. 28 11月, 2011 1 次提交
  23. 24 5月, 2011 1 次提交
  24. 17 3月, 2011 1 次提交
  25. 24 12月, 2010 2 次提交
  26. 16 12月, 2010 4 次提交
  27. 31 10月, 2010 1 次提交
  28. 20 10月, 2010 1 次提交
  29. 19 10月, 2010 4 次提交
  30. 14 10月, 2010 2 次提交