search for: visiting_team

Displaying 2 results from an estimated 2 matches for "visiting_team".

2007 Oct 16
8
Using multiple foreign keys in views
I have a model, Game, that has_many :teams. There''s a home team and an away team. I created two foreign keys, so each game can have two teams associated with it. Here''s the Team model: class Team < ActiveRecord::Base belongs_to :game, :class_name => ''Game'', :foreign_key => ''hometeam_id'' belongs_to :game, :class_name =>
2007 Jun 25
0
storing data from database into array
...wo teams participating in the game. Essentially, right now I have a line in my code that goes like this: @local_lines1 = Xmlfeed.find(:all, :conditions => ["id = ?", @id]) This is guaranteed to give me exactly one row from the database and as such, am able to make a call like this: @visiting_team = @local_lines1[0].parts[1].participant_name where the xmlfeeds table and the parts table have been linked in a model somewhere. I am able to just reference the zeroth element of the @local_lines1 variable since I know that there is only 1 row that is being selected from the database call. But...