search for: sql_to_count_plays

Displaying 1 result from an estimated 1 matches for "sql_to_count_plays".

2006 May 02
4
ordering after a inject
...I do the following command: count = result.inject({}) { |hsh, row| hsh[row[''name'']] = row[''count''].to_i; hsh } Why? Here are more specifics: My complete method is this (based off of acts_as_taggable code - not'' DHHs, but the original one): def self.sql_to_count_plays(lookback) sql = ["SELECT t.name as name, COUNT(*) as count FROM histories h, tags t WHERE h.tag_id = t.id AND created_on > ? GROUP BY tag_id ORDER BY name", lookback] result = find_by_sql(sq...