Привет, во-первых, соединения
class Blog < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :blog
has_many :comments, :as=>:commentable #Post.first.comments or Blog.posts.first.comments
end
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
end
получить все комментарии
comments=[]
Blog.first.posts.each do |post|
comments = comments | post.comments
end