Join Finder Question (ActiveRecord)

Hi

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

class User << ActiveRecord::Base
has_and_belongs_to_many :roles
end

class Role << ActiveRecord::Base

end

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

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.
Fernando.

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