I have a connection between user and hobby, user has relationship between is_ and_bollongs_to_me
and there is one for it Hobby is also has_and_belongs_to_many
.
I am trying to get the list of the hobbyists from which the user has chosen. For example, if a user selects soccer and one other basketball, then I have a question that gives me a "soccer , Basketball "shows. How can I include this in a query? Right now I am interested in hobbies for each user by using the User.find (id) .hobbies
You can also create hobbies with users to get all the hues that you choose.
Hobby.joins (users) .uniq
No comments:
Post a Comment