Join Finder Question (ActiveRecord)


I have a many-to-many relationship between users and roles

class User << ActiveRecord::Base
has_and_belongs_to_many :roles

class Role << ActiveRecord::Base


There is an user_roles table for the many-to-many and all works as

Role has an attribute (attr_x).

I want to find the Users that have a Role with attr_x == some val, in
one find.

Is there any simple way to specify in the find that

Person.role[].attr_x == some val?

Thanks very much.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs