0
我有兩個類:用戶,專利和幫助(belongs_to:用戶和belongs_to:專利) 當我點擊一個鏈接,我必須創建一個「幫助」,指的是專利,還給用戶。一個用戶是助手,另一個用戶是呼叫者。兩個協會belongs_to與相同的型號
patents_controller:
def create
@patent = Patent.find(params[:patent_id])
@patent.helps.create(:caller_id => @current_user.id, :user => @patent.user)
respond_to do |format|
format.html { redirect_to @patent }
format.js
end
end
的問題是我創建了一個「caller_id」來存儲不喜歡的用戶模型的第二user.id。 <%= help.user.name %>
給我第一個 的正確名稱如何從他的caller_id
中顯示來電者的姓名或建立連接?