ryanto/acts_as_votable

Can i have specific columns

Closed this issue · 2 comments

Hi Thanks for providing a awesome gem.
Can i have only specific columns AddCachedVotesToPosts. Let say, i dont want to update weight cache and other weight related columns. Is all mandatory or columns are optional

Thanks for your time.

Hi @ltenzil , AddCachedVotesToPosts migration if fully customizable. For example if you only want to speed up total votes of your model, your migration will be:

class AddCachedVotesToPosts < ActiveRecord::Migration
  def self.up
    add_column :posts, :cached_votes_total, :integer, :default => 0
    add_index  :posts, :cached_votes_total
  end
end

You just have to create the migration and add the columns you want

Awesome, Thanks @epergo , i thought there are some methods which use those columns.