diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-16 21:14:34 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-16 21:32:12 +0000 |
commit | a2dab46cae35a06fd5c5500037177492a047c252 (patch) | |
tree | af4be28070368eccdc1151df59384c9ca7aee1bf /activerecord/test/models | |
parent | 46ea4442f3abc33d15e03487bae1c80346eab49a (diff) | |
download | rails-a2dab46cae35a06fd5c5500037177492a047c252.tar.gz rails-a2dab46cae35a06fd5c5500037177492a047c252.tar.bz2 rails-a2dab46cae35a06fd5c5500037177492a047c252.zip |
Deprecate inferred JOINs with includes + SQL snippets.
See the CHANGELOG for details.
Fixes #950.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 4 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/person.rb | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index bfadfd9d75..d50e11d6c9 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -49,12 +49,12 @@ class Author < ActiveRecord::Base has_many :sti_post_comments, :through => :sti_posts, :source => :comments has_many :special_nonexistant_posts, :class_name => "SpecialPost", :conditions => "posts.body = 'nonexistant'" - has_many :special_nonexistant_post_comments, :through => :special_nonexistant_posts, :source => :comments, :conditions => "comments.post_id = 0" + has_many :special_nonexistant_post_comments, :through => :special_nonexistant_posts, :source => :comments, :conditions => { 'comments.post_id' => 0 } has_many :nonexistant_comments, :through => :posts has_many :hello_posts, :class_name => "Post", :conditions => "posts.body = 'hello'" has_many :hello_post_comments, :through => :hello_posts, :source => :comments - has_many :posts_with_no_comments, :class_name => 'Post', :conditions => 'comments.id is null', :include => :comments + has_many :posts_with_no_comments, :class_name => 'Post', :conditions => { 'comments.id' => nil }, :include => :comments has_many :hello_posts_with_hash_conditions, :class_name => "Post", :conditions => {:body => 'hello'} diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index fe9c465c81..d1a8a82786 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -88,6 +88,8 @@ class Firm < Company has_many :accounts has_many :unautosaved_accounts, :foreign_key => "firm_id", :class_name => 'Account', :autosave => false + has_many :association_with_references, :class_name => 'Client', :references => :foo + def log @log ||= [] end diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index 36eb08d02f..d2a0c6b40c 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -3,7 +3,8 @@ class Person < ActiveRecord::Base has_one :reader has_many :posts, :through => :readers - has_many :posts_with_no_comments, :through => :readers, :source => :post, :include => :comments, :conditions => 'comments.id is null' + has_many :posts_with_no_comments, :through => :readers, :source => :post, :include => :comments, + :conditions => 'comments.id is null', :references => :comments has_many :references has_many :bad_references |