That's a pretty easy set up. You won't have to do any joins, Rails
will take care of everything for you
Anyway, now that you've got the tables set up, you can use AR's has_*
and belongs_to methods to set up the associations.
You can set up the reverse associations if you want/need to.
This code will let you do something like:
p = Product.find 1
p.comments.first.user.username # 'dopey'
comments of course is the collection of all comments, and for each
comment you have access to the user object.
Now one problem is that if you have 1 product with 10 comments, you'll
end up making 21 db calls. 1 for the product itself, 10 for each of
the comments, and 10 for the associated user. Fortunately Rails lets
you eager load the assocations.
p = Product.find 1, :include => :comments
will take care of the join for you to include comments, so they're
fetched along with the product. You can also go as deep as you need:
p = Product.find 1, :include => [ :comments => :user ]
This will fetch all the data you need in one query.