質問

私はエラーを取得していますなぜ私はデバッグすることはできません。

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

私はタグ付けできるように、このクラスを設定します:

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

私はTagsHelperが含まれます:

module VendorsHelper
  include TagsHelper
end

これが私の見解ではあります:

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

これは私が取得エラーがあります:

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?

ベンダーの各インスタンスには、少なくとも一つのタグがあります。

役に立ちましたか?

解決

それを手に入れた、私は追加する必要:。@tags = Vendor.tag_counts_on(:tags)index controller

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top