Älphä Blüë wrote:
> So..
> 
> class Team
>   has_many :schedules
>   has_many :opponents :through => :schedules
> end
> 
> class Schedule
>   belongs_to  :team
>   belongs_to  :opponent, :class_name => "Team"
> end

And using this,

how do I reference opponents in my RESTful methods?

For instance, doing this, when I refresh my index page for schedules it 
shows both the opponents and opponent_id fields empty in my table. 
However, I've populated a few of them already in my database.

def Index
@schedules = Schedule.all
end

That's what I have currently and it doesn't find opponent or 
opponent_id, even though they are listed in the schedules table.

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to