Not sure what your controller code looks like, but there is always the :include parameter.

From the docs:
:include: Names associations that should be loaded alongside using LEFT OUTER JOINs. The symbols named refer to already defined associations. See eager loading under Associations.

Person.find(:all, :include => [ :account, :friends ])

In your example:

Theatre.find(:all, :include => [:status], :conditions => ["your query stuff goes here"])

Patrick Crowley wrote:
Let me clarify.

While Nathan's solution would work great for searching on a particular status (all "closed" theaters, for instance), I just need to get back the status for _each_ theater in a basic query search.

/search?query=apollo

When I use <%= theater.status.name %> in my for loop, I get a nil object error. So, I'm guessing I need to find a way to preload the status name for each theater object in my result set.

-- Patrick


On Nov 6, 2006, at 2:28 PM, Chris Abad wrote:

Ah, I see what you mean now. Yea, this sounds like a step in the right direction.

On Nov 6, 2006, at 2:27 PM, Nathan Colgate Clark wrote:

Probably, Yeah. Try passing it with your pagination_links method. If i remember from Friday:

pagination_links(@results, {:query => params[:query], :status => params[:status]})

might get you some links like:

/search?query=apollo&status=1

where 1 is "open" or whatever.

Good luck.
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby



--
Nathan Colgate Clark
Web Designer and Architect
Brand New Box
(619) 322-9459
www.brandnewbox.com

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to