Receiving nil on ID results using select

On my teams table I have a column for ESPN names where ESPN uses it's own naming convention for teams. I'm trying to do a simple find_by_field...

@team = "Navy"

@o_team = Team.find_by_espn_team(@team, :select => "teams.id AS opponent_id") p @o_team[:opponent_id] p @o_team.opponent_id

In the console it shows the correct number but right after posting the number it states:

Team = Navy | ESPN ID = 2426 | TEAM ID = 1 61 61

NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.

61 is the correct ID for the first opponent and both puts show the correct number. The line this points at points to the first p @o_team[:opponent_id] and if I remove it and use the second it does the same, pointing to the second puts statement.

If I try a generic non-select query and use team.id or team_id I receive a whiny nil error.

Any help would be appreciated.

Thanks.

Team.all(:conditions => {:espn_team => @team}).each do |row|   @o_team = row.id end

p @o_team

The .find_by query was the cause. Swapping to all and applying a condition for the team works.