Hello,

you could simply put in your Game model :

  belongs_to :referee_1, :class_name => 'Referee'
  belongs_to :referee_2, :class_name => 'Referee'

But the problem is in the Referee model, what you would want is :

  has_one :game

but that doesnt work because you have in fact two possible columns for 
the foreign key in the games table, leading to all the problems "Clever 
Neologism" mentionned.

Now if you want to be able to get the game the referee is assigned to 
(but ONLY in read mode), you could put in your Referee model :

def game
  Game.find(:first, :conditions=>"referee_1_id = "+id.to_s+" or 
referee_2_id = "+id.to_s)
end

of course the language itself doesn't make it read only... so be careful 
:)
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to