多対多の関係から値を表示しようとしているim
私の見解では、私は次のように呼んでいます
schedule.opponents.name
このコードは「Opponent」という単語を表示しているだけですが、エラーは表示されていません。
私がbelongs_to関係を持っている他のメソッドでは、このメソッドは私が求めている値を表示したようです
任意のヒント?
class Opponent < ActiveRecord::Base
has_many :schedules
has_many :teams
attr_accessible :name
end
class Schedule < ActiveRecord::Base
has_and_belongs_to_many :opponents
has_many :teams
attr_accessible :location_id, :date, :opponent_id, :time, :for, :against, :event, :team, :home_or_away