越來越屬性故障那是我的模型:導軌 - 從關係
class Person < ActiveRecord::Base
has_many :honors, :dependent => :destroy, :foreign_key => "honored_id"
has_many :honor_creators, :through => :honors, :source => :person, :foreign_key => "person_id"
class Group
has_many :honorss,:foreign_key => "group_id"
class Honor
belongs_to :person, :class_name => 'Person', :foreign_key => "person_id"
belongs_to :honored, :class_name => 'Person', :foreign_key => "honored_id"
belongs_to :group, :class_name => 'Group', :foreign_key => "group_id"
由於honors
在person#show
頁面顯示,這裏是我的控制器:
def show
...
@honors = @person.honors.paginate(:page => params[:page], :per_page => Honor.per_page)
end
而我的觀點:
<% unless @honors.empty? %>
<% @honors.each do |ho| %>
我的問題是:使用ho
我得到所有來自honor
的屬性,但是我想獲得它所屬的榮譽創造者和團隊。我怎樣才能做到這一點?
謝謝!