I have a User model which has has_many relationship with Identity model.
I want to execute includes query with where clause.
User.includes(:identities).where("identities.provider = 'facebook')
But it is giving me error.
PG::UndefinedTable: ERROR: missing FROM-clause entry for table "identities"
while it works fine with joins
User.joins(:identities).where("identities.provider = 'facebook')
I don't want to use scope. I just want to use where like I do with joins clause.