daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. id   | Name
  2.  1    | some-name#1
  3.  2    | some-name#2  
  4.  3    | some-name#3
  5.    
  6. id   | team_id1 | team_id2 | result1 | result2
  7.  1   |     2    |    3     |    -1   |   -1
  8.    
  9. has_many :matches
  10.    
  11. belongs_to :team_one, :foreign_key => "team_id1", :class_name => "Team"
  12. belongs_to :team_two, :foreign_key => "team_id2", :class_name => "Team"
  13.    
  14. match = match.find(1)
  15. match.team_one.name ### gives -> some-name#2
  16. match.team_two.name ### gives -> some-name#3
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top