_tags.html.erb
#Version 1 (Just lists out habits tags)
<% tag_cloud Habit.tag_counts, %w{s m l} do |tag, css_class| %>
<%= link_to tag.name, tag_path(tag.name), class: css_class %>
<% end %>
#Version 2
<% tag_cloud(@tags, %w(css1 css2 css3 css4)) do |tag, css_class| %>
<%= link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %>
<% end %>
How can we get it where it list's out the current_user's habits AND goals, valuations, quantifieds? f.text_field :tag_list
is in the _form of each of these four models, which are also separate tables in the database.
I also added the below code to each of the four models. Here's is how it looks for valuations:
Helper
module ValuationsHelper
include ActsAsTaggableOn::TagsHelper
end
Controller
class ValuationController < ApplicationController
def tag_cloud
@tags = Valuation.tag_counts_on(:tags)
end
end
and for the User Model
User.tag_counts_on(:tags)
acts_as_tagger
acts_as_taggable
I'm using the acts-as-taggable-on gem, which I implemented from railscasts. Please let me know if you need any further code or explanation =]