aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorTristan Dunn <tristanzdunn@gmail.com>2009-08-10 00:41:36 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-08-10 00:41:36 +0100
commit0472839d684d836e1e7ecd39722c313410d76d5b (patch)
treecbb7ac14634a388116cc43600ba2c163f0b0532a /activerecord/test/models
parent00d6c766608f90ce64f11feb98786cbc7f71b89d (diff)
downloadrails-0472839d684d836e1e7ecd39722c313410d76d5b.tar.gz
rails-0472839d684d836e1e7ecd39722c313410d76d5b.tar.bz2
rails-0472839d684d836e1e7ecd39722c313410d76d5b.zip
Prevent overwriting of table name in merging SQL conditions [#2949 state:resolved]
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/comment.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index f7f07c103f..399dea9f12 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -1,6 +1,10 @@
class Comment < ActiveRecord::Base
named_scope :containing_the_letter_e, :conditions => "comments.body LIKE '%e%'"
-
+ named_scope :for_first_post, :conditions => { :post_id => 1 }
+ named_scope :for_first_author,
+ :joins => :post,
+ :conditions => { "posts.author_id" => 1 }
+
belongs_to :post, :counter_cache => true
def self.what_are_you