Restricting a FIND based on the results of another


This it really depends on what the relationships are between these
tables. One way would be to use a has_many, or has_many :through
relationship between users and people... Use :through if you want to
add other information to your access table... like this:

class User < ActiveRecord::Base
    has_many :access
    has_many :people, :through => :access

... Then you could get all the people like this:

user = User.find(some_id)
@people = user.people

or like:

user = User.find(some_id)
@people = user.people.find(:all, :conditions => blah)

Not sure if this is the exact syntax... find more here:

It sounds like what you really want is RBAC (Role Based Authentication
Have a look at ActiveRBAC:

Good luck,