From 0fd3e4cd2b2b1b31304a922dc65284d5363f78b6 Mon Sep 17 00:00:00 2001 From: Mark Catley Date: Sat, 21 Jun 2008 23:41:30 +1200 Subject: Fix column collision with named_scope and :joins. [#46 state:resolved] --- activerecord/test/models/post.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activerecord/test/models') 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" -- cgit v1.2.3