Rails 4: (acts as taggable) creating a tag cloud based only on a specific users posts -
i attempting create tag cloud based on users microposts (obvious counts on each tag user) using in controller
@tags = @user.microposts.tag_counts_on(:tags)
and in view
<% tag_cloud @tags, %w[xxs xs s m l xl xxl] |tag, css_class| %> <%= link_to tag, questions_by_tag_user_path(@user, tag: tag.name), class: css_class %> <% end %>
the problem is, having checked on , over, returning tag cloud sizes based on tag counts based on microposts , not ones @user.
i can't see why , documentation deprecated:
user.find(:first).posts.tag_counts_on(:tags)
any thoughts?
this work, if call tag_counts_on
on posts scope:
post.where(user_id: 1).tag_counts_on(:tag)
Comments
Post a Comment