I'm trying to make my tag_cloud only show the popular tags for the specific day, week, or month etc.
I'm trying to get it to work through passing a sql condition into the tag_counts_on option.
For example, trying to make a tag_cloud of popular tags for today
<% tag_cloud Micropost.tag_counts_on(:tags, options = {:conditions => ["SELECT * FROM microposts WHERE DATE(microposts.created_at) = DATE(NOW())"]}).limit(10).order('count desc'), %w[s m l] do |tag, css_class| %>
<%= link_to tag.name, tag_path(tag.name), class: css_class%>
but I get the following error
PG::Error: ERROR: subquery must return only one column
LINE 1: ...0) AS taggings ON taggings.tag_id = tags.id WHERE (SELECT * ...
^
: SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "tags" JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM "taggings" INNER JOIN microposts ON microposts.id = taggings.taggable_id WHERE (taggings.taggable_type = 'Micropost' AND taggings.context = 'tags') AND (taggings.taggable_id IN(SELECT microposts.id FROM "microposts" ORDER BY created_at DESC)) GROUP BY taggings.tag_id HAVING COUNT(taggings.tag_id) > 0) AS taggings ON taggings.tag_id = tags.id WHERE (SELECT * FROM microposts WHERE DATE(microposts.created_at) = DATE(NOW())) LIMIT 10) subquery_for_count
Not sure how to remedy this problem or if this is even a good way to try and accomplish what I want to do.