I\'ve got three (relevant) models, specified like this:
class User < ActiveRecord::Base
has_many :posts
has_many :comments
has_many :comments_receiv
A quick-n-dirty solution would be to add a custom method (e.g. getusercomments) to your users-controller that would return all the comments:
def getusercomments
@user = User.find(params[:id])
@comments = @user.posts.comments
end
Then add this method to your users-route:
map.resources :users, :member => { :getusercomments => :get }
Afterwards you should be able to call the following to get all comments of a user:
http://some_domain.com/users/123/getusercomments