Hi,
I noticed using the Active Record #pluck method you are not limited to selecting multiple fields from a single table but also from multiple tables. In fact, you can do more than “selecting” multiple fields from multiple tables.
User.distinct.joins(categories, :comments: :likes).pluck(“users.first_name || ’ ’ || users.last_name, categories.name, comments.ttitle, likes.do_not_like”)
I spent a lot of time pulling my hair wondering how to select multiple fields from multiple tables in the most efficient way and ended up doing a lot of research in the internet and the source code. I suggest adding this to the Rails Query Interface documentation on #pluck method Active Record Query Interface — Ruby on Rails Guides to save other people’s time.
Jędrek