I am using Rails 3.2.
I have following models:
Blog
Comment
User
class Blog < ActiveRecord::Base
has_many :comments
end
I want a list of commenters for a given blog.
I want something like
class Blog < ActiveRecord::Base
has_many :comments
has_many :commenters, ...fill in the blank...
end
@blog.commenters should return an array of User instances.
What should I fill the blanks with above.
I guess you have the following
All you need to add is
Note: the
:sourceis needed because the relation oncommentsis not calledcommenters