When i try to do @user.communities, Rails is searching for foreign key of user in profile
table, whereas profile and user have habtm relationship.
How to solve this problem?
When do @user.communities,
flow should be like this:
Join the profile and profile user table and get all the profiles that
belong to the user and, from the profiles check the community it belongs
to and then return the result(communities).
but am not getting the desired result because rails is not joining all
the tables needed, it is checking for community_id in profile_users
whereas it is in profile table.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.