Search code examples
ruby-on-railsrubyacts-as-votable

Delete unnecessary fields from acts_as_votable gem migration


Rails acts_as_votable gem generates current set of fields:

:cached_votes_score
:cached_votes_total
:cached_weighted_total
:cached_weighted_average
:cached_votes_up     
:cached_votes_down   
:cached_weighted_score

Which fields can be deleted so that only the average result of voting can be displayed?


Solution

  • According to the docs, caching is optional, used to improve performance. If they have no need to you, you can simply erase the columns.

    To speed up perform you can add cache columns to your votable model's table. These columns will automatically be updated after each vote.