users = User.arel_table
comments = Comment.arel_table
#select users with comments
User.join(
users.joins(comments).on(
users[:id].eq(comments[:user_id])
).join_sources
)
Created
February 17, 2016 15:30
-
-
Save wycleffsean/741823ede64c1c86bbe9 to your computer and use it in GitHub Desktop.
Arel and ActiveRecord
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment