views:

165

answers:

1

I can't debug why I am getting an error:

class VendorsController < ApplicationController
  def tag_cloud
    @tags = Vendor.tag_counts_on(:tags)
  end

I set this class as Taggable:

class Vendor < ActiveRecord::Base
  acts_as_taggable_on :tags, :competitors

I include the TagsHelper:

module VendorsHelper
  include TagsHelper
end

This is in my View:

 <% 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 %>

This is the error that I get:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.empty?

Each instance of Vendor has at least one Tag.

+2  A: 

got it, I needed to add @tags = Vendor.tag_counts_on(:tags) in the index controller

Angela
Thanks, I was stuck on this!
GreenRails