J_Garvin
(J Garvin)
January 15, 2007, 4:29pm
1
I haven't tested the below, but I was working on something very similar
this weekend so, I believe it should work... assuming I understood your
questions correctly.
has_many :validated_credentials_as_referee, :foreign_key =>
'referee_id', :class_name => 'Credentials', :conditions => 'flag = 1'
has_many :validated_referenced_users, :through =>
:validated_credentials_as_referee
Kad Kerforn wrote:
Ian_Duggan
(Ian Duggan)
January 15, 2007, 7:02pm
2
I wrestled with this previously. Not sure which version of rails you are on, but I had to employ the fixes in bug #6466 (I'm on edge rails).
I also added the extensions stuff to get the << operator working.
has_many :connections,
:foreign_key => 'source_user_id',
:class_name => 'Connection'
has_many :refereeships,
:class_name => 'Connection',
:foreign_key => "source_user_id",
:conditions => "connection_type = 'R'"
has_many :referees_out,
:through => :refereeships,
:source => :target_user do
def construct_join_attributes(associate)
super.merge({:connection_type => 'R'})
end
end