Created
January 19, 2016 02:33
-
-
Save bethsecor/b7bea2d6fb2770c3388a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Combatant < ActiveRecord::Base | |
belongs_to :dojo | |
has_many :winning_fights, :class_name => "Fight", :foreign_key => "winning_combatant_id" | |
has_many :losing_fights, :class_name => "Fight", :foreign_key => "losing_combatant_id" | |
end | |
class Dojo < ActiveRecord::Base | |
has_many :combatants | |
has_many :winning_fights, :class_name => "Fight", :foreign_key => "winning_dojo_id" | |
has_many :losing_fights, :class_name => "Fight", :foreign_key => "losing_dojo_id" | |
end | |
class Fight < ActiveRecord::Base | |
belongs_to :winning_dojo, :class_name => "Dojo" | |
belongs_to :losing_dojo, :class_name => "Dojo" | |
belongs_to :winning_combatant, :class_name => "Combatant" | |
belongs_to :losing_combatant, :class_name => "Combatant" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment