It looks like you're new here. If you want to get involved, click one of these buttons!
I've been exploring has_many, belongs_to, many_many, etc. relations and it's very slick and easy to use once you get it set up.
Here's my question. I have a
products table and a
reviews table in addition to the
elefant_user table. From the product page, I want to be able to show all reviews and the name of the reviewer, but reviewer name comes from
I have defined
products -> has_many reviews and
elefant_user -> has_many reviews. On the products page, while looping through the reviews, what's the best way to get the reviewer's name?
Pre-elefant I would have used a subquery like
SELECT reviews.*, (SELECT userdata FROM elefant_user WHERE reviews.user_id = elefant_user.id) AS userdata ...