Displaying 2 results from an estimated 2 matches for "awayteam".
Did you mean:
away_team
2007 Oct 15
2
Association Help , 2 Teams playing a FootballGame
...d
class Team < ActiveRecord::Base
end
I want to be able to do something like this
@t1 = Team.create(:name=>"Michigan Wolverines football")
@t1.save
@t2 = Team.create(:name=>"Penn State Nittany Lions football")
@t2.save
@g = FootballGame.create(:hometeam => @t1, :awayteam => @t2)
@g.save
my migrations:
create_table :football_games do |t|
t.column :hometeam, :integer
t.column :awayteam, :integer
end
create_table :teamsdo |t|
t.column :name, :integer
end
I''ve tried various has_one declarations but I keep ending up with NULL
s for...
2006 Jan 09
3
Include with two references of one model of the same table
Hey guys,
I just came across this oddity, not sure what to make of it yet, but
I think it might be incorrect behavior. When doing a @inst.find(:all,
:include => ["hometeam", "awayteam"] ...) hometeam and awayteam are two
references from a belongs_to that is of the same model and of the same
table. I will get a pgerror stating that "matches", which is the table
that these fk''s loop back to is being ambiguously referenced. The SQL
spit out showed onl...