Tim*_* T. 3 tags tag-cloud acts-as-taggable-on-ster
我无法调试为什么我收到错误:
class VendorsController < ApplicationController
def tag_cloud
@tags = Vendor.tag_counts_on(:tags)
end
Run Code Online (Sandbox Code Playgroud)
我把这个类设置为Taggable:
class Vendor < ActiveRecord::Base
acts_as_taggable_on :tags, :competitors
Run Code Online (Sandbox Code Playgroud)
我包含了TagsHelper:
module VendorsHelper
include TagsHelper
end
Run Code Online (Sandbox Code Playgroud)
这在我看来:
<% 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 %>
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
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?
Run Code Online (Sandbox Code Playgroud)
供应商的每个实例至少有一个标签.