def vote(options)
options[:post] = self
vote = self.votes.create(options)
return vote if vote.valid?
nil
end
Shouldn '를 작동합니까이
def vote(options)
vote = self.votes.create(options)
return vote if vote.valid?
nil
end
작동하지 않는 투표 예를
를 생성하는 투표 방법과 포스트 클래스가 t .create 전화가 자동으로 추가합니다 : 게시물 협회?
설명
클래스 포스트 < 액티브 :: 자료 has_many : 투표 끝
클래스 투표 < 액티브 :: 자료 belongs_to : 사용자 : counter_cache => 진정한 belongs_to : 끝을 게시
어떻게이 작동하지 않습니다
어쩌면 당신은 단지로 다시 작성해야? 더 자세한 설명이 필요합니다. –
추가 세부 사항이 추가되었습니다. – Alexandre