Forum: Ruby on Rails Associations and find

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.
299e3ae576d842b84594146b64e2501b?d=identicon&s=25 najt (Guest)
on 2007-05-08 19:31
(Received via mailing list)
Hi. I have the following models

class User < ActiveRecord::Base
  has_and_belongs_to_many :projects

class Project < ActiveRecord::Base
  has_many :castings, :dependent => :destroy
  has_many :candidates, :through => :castings
  has_and_belongs_to_many :users

class Candidate < ActiveRecord::Base
  has_many :castings, :dependent => :destroy
  has_many :projects, :through => :castings, :uniq => true

class Casting < ActiveRecord::Base
  belongs_to :project
  belongs_to :candidate

What I need is when I issue a Candidate.find that it will only return
candidates for which the user has access to (via the projects_users

I also need a way to check if the user has access to a specific

Thank you
This topic is locked and can not be replied to.