In order to make vote_fu work in Heroku’s PostgreSQL you need to make a slight modification in the tally method, to follow a classical SQL notation:
Add this method in acts_as_voteable.rb just after options_for_tally method:
1 | def column_names_for_tally |
2 | column_names.map { |column| "#{table_name}.#{column}" }.join( ", " ) |
3 | end |
In options_for_tally method find line that starts with “group_by =” and replace it with:
1 | group_by = "#{Vote.table_name}.voteable_id, #{column_names_for_tally}" |
That’s it. Should work now.
No comments:
Post a Comment