I've got a controller called Listing that works with the Apartment model. The Listing index.rhtml file basically just shows a list of the areas by name (ie: North, South, East, West). What I would like is to be able to click on one of the areas and have it display a simple table of just the apartments in that particular area.

What I think I should be able to do is have the link call the list method, which would then sort the data by the area id (apartment.building.area_id). But when I tried using :conditions => "building.area_id = '3', it locked up. Also, I'm not entirely sure how to pass an argument to the list method from the list of areas, or if that is even possible.

There's one more change you need to make because @area doesn't have "apartments", it has buildings. You need to define a :through relationship in Area to give it many apartments through buildings. Like this:

Re: Problem with a list

I added the line "has_many :apartments, :through => :buildings" to my Area.rb file, but now when I try to run the application, I get an error that says "Unknown key(s): through". I checked the Ruby on Rails wiki for ThroughAssociation and it looks like I did it correctly. Any ideas what went wrong?