This is probably a n00b question. I have CitiesUser model:
class CitiesUser < ActiveRecord::Base {
belongs_to :city
belongs_to :user
}
In the controller I do this:
def index {
@cities_users = CitiesUser.find(:all,
:conditions => { :user_id => session[:user][:id] },
:include => [:city])
and in the view this:
<%= @cities_users.inspect %>
Now, I don't see associated model City anywhere. How do I iterate in my view over Cities that are attached to CitiesUser?
My WEBRick says:
CitiesUser Load (0.6ms) SELECT "cities_users".* FROM "cities_users" WHERE "cities_users"."user_id" = 1
City Load (0.8ms) SELECT "cities".* FROM "cities" WHERE ("cities"."id" IN (5,3))
So the association is being loaded, right? Which variable is it stored in, or how to I put it inside my CitiesUser?