1
所以,我有評級未定義的方法或變量錯誤(Rails)的
class Rating < ActiveRecord::Base
attr_accessible :name
has_many :parties
end
與黨,屬於評級
class Party < ActiveRecord::Base
attr_accessible :name, :rating_id
belongs_to :rating
end
在show.html.erb的評價觀點
<%= @rating.parties %>
顯示屬於該評級的所有參與方。
錯誤:
undefined method `parties'
我不知道爲什麼,如果我定義了黨新型屬於評級。在例子中看過類似的東西。
請發佈**完整**錯誤消息。你確定'@ rating'不是零嗎? – iblue 2013-02-26 22:49:31