Forum: Ruby on Rails Join Finder Question (ActiveRecord)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Fernando R. (Guest)
on 2006-03-29 22:54

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 topic is locked and can not be replied to.