Query with 2 relationship with one model

I have a question about query on Rails.
I have my models defined as shown below:

  • Person
    has_many :autors, :dependent => :destroy
    has_many :accused, :dependent => :destroy

  • Reus
    belongs_to :person
    belongs_to :proceeding

  • Autores
    belongs_to :person
    belongs_to :proceeding

  • Proceeding
    has_many :accused, :dependent => :destroy
    has_many :autors, :dependent => :destroy
    has_many :persons, :through => :autors, :as => :person_autor
    has_many :persons, :through => :accused, :as => :person_accused

The question is: How do i filter out the name of accused and the autor
in
the same query.

PS: Sorry my english, i’m not write in english a long time.

Thanks.

Att
Vanildo P.

On 12 August 2011 20:16, Vanildo P. [email protected] wrote:

belongs_to :proceeding

  • Proceeding
    has_many :accused, :dependent => :destroy
    has_many :autors, :dependent => :destroy
    has_many :persons, :through => :autors, :as => :person_autor
    has_many :persons, :through => :accused, :as => :person_accused

The question is: How do i filter out the name of accused and the autor in
the same query.

Sorry, I do not understand what you want to do. Perhaps you could
explain in a bit more detail.

Colin