I am attempting to create a tag cloud based on a users microposts (obvious the counts on each tag for that user) using this in my controller
@tags = @user.microposts.tag_counts_on(:tags)
and this in my view
<% tag_cloud @tags, %w[xxs xs s m l xl xxl] do |tag, css_class| %>
<%= link_to tag, questions_by_tag_user_path(@user, tag: tag.name), class: css_class %>
<% end %>
The problem is, having checked this over and over, this is returning the tag cloud with the sizes based on tag counts based on all microposts and not just the ones by the @user.
I can't see why this is and the documentation is deprecated:
User.find(:first).posts.tag_counts_on(:tags)
Any thoughts?
This would work, if you would call the
tag_counts_on
on the Posts scope: