• L
    The Association Relation should use `empty?` and `size` from Relation. · 34945e41
    Lauro Caetano 提交于
    968c581e have introduced this bug #14744
    on Association Relation when the method `empty?` or `size` was called.
    
    Example:
      # Given an author that does have 3 posts, but none of them with the
      # title 'Some Title'
      Author.last.posts.where(title: 'Some Title').size
      # => 3
    
    It was occurring, because the Association Relation had implemented these
    methods based on `@association`, this way giving wrong results.
    
    To fix it, was necessary to remove the methods `empty?` and `size` from
    Association Relation. It just have to use these methods from Relation.
    
    Example:
      # Given an author that does have 3 posts, but none of them with the
      # title 'Some Title'
      Author.last.posts.where(title: 'Some Title').size
      # => 0
      # Now it will return the correct value.
    
    Fixes #14744.
    34945e41
relations_test.rb 51.2 KB