Trying to return all comments associated with articles written by a particular user.
The following code gives me the error:
undefined method `joins' for #<User:0x000001042c8bc0>
under Rails 3.1
class User
has_many :articles
def comments
self.joins(:articles => :comments)
end
end
You probably want a
has_many :throughhere.