我有以下型号
class Forum < ActiveRecord::Base
has_many :topics
end
class Topic < ActiveRecord::Base
belongs_to :forum
has_many :posts
end
class Posts < ActiveRecord::Base
belongs_to :topic
belongs_to :user
end
我想加入这些关联(在主题和帖子上都有一些条件),所以我做了Topic.joins(:forum, :posts).where(some condition)
,但我想访问所有三个表中的属性。我怎样才能做到这一点?