vote_fu to work in Heroku (Postgres)

December 6, 2009 at 3:19 pm Leave a comment

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:

	def column_names_for_tally
	   column_names.map { |column| "#{table_name}.#{column}" }.join(", ")
	end

In options_for_tally method find line that starts with “group_by =” and replace it with:

group_by  = "#{Vote.table_name}.voteable_id, #{column_names_for_tally}"

That’s it. Should work now.

Advertisements

Entry filed under: Uncategorized.

Rails 2.3.5 Upgrading the script/console in Windows VISTA environment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Kindle

Get Kindle - the best e-book reader, that I personally use, and the only one that you can read on the beach - very useful: Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)

%d bloggers like this: