Ruby on rails 4 Rails 4:(充当标记)仅基于特定用户帖子创建标记云
我正试图在我的控制器中使用它创建一个基于用户microspots(显然是该用户每个标签上的计数)的标签云Ruby on rails 4 Rails 4:(充当标记)仅基于特定用户帖子创建标记云,ruby-on-rails-4,tag-cloud,acts-as-taggable,Ruby On Rails 4,Tag Cloud,Acts As Taggable,我正试图在我的控制器中使用它创建一个基于用户microspots(显然是该用户每个标签上的计数)的标签云 @tags = @user.microposts.tag_counts_on(:tags) 在我看来 <% tag_cloud @tags, %w[xxs xs s m l xl xxl] do |tag, css_class| %> <%= link_to tag, questions_by_tag_user_
@tags = @user.microposts.tag_counts_on(:tags)
在我看来
<% 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 %>
有什么想法吗?如果您调用Posts范围上的
标记\u counts\u,这将起作用:
Post.where(user_id: 1).tag_counts_on(:tag)
Post.where(user_id: 1).tag_counts_on(:tag)