title: How to display a tag cloud from Acts as Taggable On on an index page in Ruby on Rails 3.2.7?
body: <p>I'm very new to Ruby on Rails, so there's probably a simple solution I'm missing.</p>
  
  <p>The tldr version - how do I display an Acts As Taggable On tag cloud of distinct (i.e. no repeating) tags assigned to all instances of a particular model on that model's index page? </p>
  
  <p>The longer version - I have a model called Video in which I have successfully managed to implement a tagging feature using <a href="https://github.com/mbleigh/acts-as-taggable-on/" rel="nofollow">Acts as Taggable On</a> and <a href="http://www.alexmuraro.me/posts/acts-as-taggable-on-a-short-tutorial" rel="nofollow">this fantastic tutorial</a>.</p>
  
  <p>What I'd like to do now is, on the Video's index page (index.html.erb), to display a summary of all the individual tags that a user has assigned to individual videos. For example, lets say I have three videos, each tagged as follows:</p>
  
  <pre><code>Video 1: great, banana, book
  Video 2: small, great, apple
  Video 3: rubbish, small, banana
  </code></pre>
  
  <p>I'd like the index page to display the following list of tags: </p>
  
  <pre><code>great, banana, book, small, apple, rubbish.
  </code></pre>
  
  <p>The code for my model (elided) is as follows:</p>
  
  <pre><code>class Video &lt; ActiveRecord::Base
  
  attr_accessible :tag_list # Lots of other fields in here as well, but not relevant
  
  acts_as_taggable_on :tags
  
  end
  </code></pre>
  
  <p>The code in my Video helper is as follows:</p>
  
  <pre><code>module VideosHelper
  
    include ActsAsTaggableOn::TagsHelper
  
  end
  </code></pre>
  
  <p>Finally, as per the gem's documentation, I've added the following code to my controller:</p>
  
  <pre><code>class VideosController &lt; ApplicationController
    def tag_cloud
      @tags = Video.tag_counts_on(:tags)
    end
  end
  </code></pre>
  
  <p>So, what code should I be adding to the index page of my view? I tried the following, again as per the documentation:</p>
  
  <pre><code>&lt;% tag_cloud(@tags, %w(css1 css2 css3 css4)) do |tag, css_class| %&gt;
    &lt;%= link_to tag.name, { :action =&gt; :tag, :id =&gt; tag.name }, :class =&gt; css_class %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>But this returns the following error when I go to the Video index page:</p>
  
  <pre><code>undefined method `empty?' for nil:NilClass
  </code></pre>
  
  <p>As I say, I'm obviously missing something simple, but I'm completely new to Rails (and Ruby) so I'm still finding my feet.</p>