Should voices be their own model in the RoR app?

Suppose you want to create a site similar to Digg.com. Should the votes be its separate separate model or should the votes be a field in the table for the model of the object they voted for?

+3
source share
3 answers

It depends on how much information you want to keep. If you only have a link to something and a total score, you do not need a model. If you want to keep who voted, how many votes were received, the timestamps when the votes were received, and be able to roll back votes from naughty sources, then you need to save each of these votes as your own model. Personally, I would make each voice my own recording if I designed such a system.

+3
source

Considering site requirements like Digg.com, I would say it's my own model. To a large extent, because of the need to detect so-called "voice calls" - to identify groups of fake voters.

- . , MySQL ( , ), . MySQL.

+3

It depends on whether you want to keep the relevant voting information or not. This has nothing to do with RoR, but with database normalization.

If you want to save additional information with votes, for example, perhaps the date when it was recorded, you should save it in another table (and as such it will be a different model). If not, you can save it in the table of other objects.

0
source

All Articles