Class Match < ActiveRecord::Base
belongs_to :winning_team, :class_name => "Team", :foreign_key
=>
"winner_id"
belongs_to :losing_team, :class_name => "Team" , :foreign_key
=>
"loser_id"
beongs_to :submitter, :class_name => "User", :foreign_key
=>
"submitter_id"
belongs_to :Approver, :class_name => "User", :foreign_key
=>
"approver_id"
has_many :games
end
Table should look like this:
id
winner_id
loser_id
submitter_id
approver_id
<additonal fields>
the other classes:
class User < ActiveRecord::Base
has_many :submitted_matches, :class_name => "Match", :foreign_key
=>
"submitter_id"
has_many :approved_matches, :class_name => "Match", :foreign_key
=>
"approver_id
end
class Team < ActiveRecord::Base
has_many :won_games, :class_name => "Match", :foreign_key =>
"winner_id"
has_many :lost_games, :class_name => "Match", :foreign_key =>
"loser_id"
end
something like that ...
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---