If I have the following code:
User.where(users: {id: [1,2,3,4,5] } )
.joins("left outer join carts on users.id = carts.user_id)
.pluck("user.id", "user.name", "carts.id")
And this work fine. But I think it is cleaner if I can do something similar to the where clause like:
User.where(users: {id: [1,2,3,4,5] } )
.joins("left outer join carts on users.id = carts.user_id)
.pluck(users: [:id, :name], carts : [:id])
Is the second approach possible?
Also to note I know the left_joins method exists but I'm not using it here to make the example clear.