aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/post.rb
diff options
context:
space:
mode:
authorMark Catley <mark@nexx.co.nz>2008-06-21 23:41:30 +1200
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-22 19:21:15 -0700
commit0fd3e4cd2b2b1b31304a922dc65284d5363f78b6 (patch)
tree512a7018a967141c3762c0553e25f5dc4851e70f /activerecord/test/models/post.rb
parentbb6e8eea5a8190aaab67da0a7efedb3bb3d9fccb (diff)
downloadrails-0fd3e4cd2b2b1b31304a922dc65284d5363f78b6.tar.gz
rails-0fd3e4cd2b2b1b31304a922dc65284d5363f78b6.tar.bz2
rails-0fd3e4cd2b2b1b31304a922dc65284d5363f78b6.zip
Fix column collision with named_scope and :joins. [#46 state:resolved]
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r--activerecord/test/models/post.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index d9101706b5..3adbc0ce1f 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -1,6 +1,11 @@
class Post < ActiveRecord::Base
named_scope :containing_the_letter_a, :conditions => "body LIKE '%a%'"
-
+ named_scope :with_authors_at_address, lambda { |address| {
+ :conditions => [ 'authors.author_address_id = ?', address.id ],
+ :joins => 'JOIN authors ON authors.id = posts.author_id'
+ }
+ }
+
belongs_to :author do
def greeting
"hello"