0
저는 사용자, 특허 및 도움말 (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
문제는 내가 사용자 모델에 좋아하지 않는 두 번째 user.id를 저장하는 "caller_id"를 생성합니다. <%= help.user.name %>
첫 번째의 올바른 이름을 내게 발신자의 이름을 그의 caller_id
에서 표시하거나 연결하려면 어떻게해야합니까?