From aa227ec507caf507e072af7403c56ebdc66bdf87 Mon Sep 17 00:00:00 2001 From: Coleman Date: Tue, 22 Jul 2008 00:31:10 -0500 Subject: [PATCH] manually join for new active record --- app/controllers/experiences_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/experiences_controller.rb b/app/controllers/experiences_controller.rb index c5eab6d..dc52564 100644 --- a/app/controllers/experiences_controller.rb +++ b/app/controllers/experiences_controller.rb @@ -18,8 +18,9 @@ class ExperiencesController < ApplicationController conditions = [ cond_ary.join(' AND '), cond_var ] @total_count = Experience.count("people_id = #{@people.id}") @pages, @experiences = paginate :experiences, - :include => [ 'beer' ], :order => [ 'beers.title ASC' ], - :per_page => per_page, :conditions => conditions + :order => [ 'beers.title ASC' ], + :per_page => per_page, :conditions => conditions, + :joins => "LEFT OUTER JOIN beers ON beers.id = experiences.beer_id" brewery_ids = @experiences.collect { |e| e.beer.brewery_id } @breweries = Brewery.find(brewery_ids, :order => 'title ASC') flash.now[:notice] = 'No experience yet.' if @experiences.empty?