diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-02 20:33:18 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-03 16:24:31 -0800 |
commit | 3103296a61709e808aa89c3d37cf22bcdbc5a675 (patch) | |
tree | 2f8b031165014329b4c77a785c17f06c056bf850 /activerecord/test/models | |
parent | d6289aadce1b8fa93e799500e52f92ce8d159d6f (diff) | |
download | rails-3103296a61709e808aa89c3d37cf22bcdbc5a675.tar.gz rails-3103296a61709e808aa89c3d37cf22bcdbc5a675.tar.bz2 rails-3103296a61709e808aa89c3d37cf22bcdbc5a675.zip |
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.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/comment.rb | 5 | ||||
-rw-r--r-- | activerecord/test/models/post.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/project.rb | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index 88061b2145..a9aa0afced 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -15,6 +15,11 @@ class Comment < ActiveRecord::Base def self.search_by_type(q) self.find(:all, :conditions => ["#{QUOTED_TYPE} = ?", q]) end + + def self.all_as_method + all + end + scope :all_as_scope, {} end class SpecialComment < Comment diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index b51f7ff48f..1c95d30d6b 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -51,7 +51,7 @@ class Post < ActiveRecord::Base has_many :taggings, :as => :taggable has_many :tags, :through => :taggings do def add_joins_and_select - find :all, :select => 'tags.*, authors.id as author_id', :include => false, + find :all, :select => 'tags.*, authors.id as author_id', :joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id' end end diff --git a/activerecord/test/models/project.rb b/activerecord/test/models/project.rb index 416032cb75..8a53a8f803 100644 --- a/activerecord/test/models/project.rb +++ b/activerecord/test/models/project.rb @@ -28,6 +28,10 @@ class Project < ActiveRecord::Base @developers_log = [] end + def self.all_as_method + all + end + scope :all_as_scope, {} end class SpecialProject < Project |