Model association question

前端 未结 2 492
孤街浪徒
孤街浪徒 2021-01-15 23:19

So I\'m implementing an up/down voting mechanism for which I\'m generating a model. So far I understand that a video (what will be voted on) has one vote_count, and vote_cou

2条回答
  •  情话喂你
    2021-01-15 23:54

    Am I missing something here? Why not assign a netVoteTally as a property of Videos. Initialize it to zero when video.new is called and have incNetVideoTally and decNetVideoTally methods that are accessible outside the video method? Just my $0.02.

提交回复
热议问题