helper function not found in view
Posted
by cbrulak
on Stack Overflow
See other posts from Stack Overflow
or by cbrulak
Published on 2010-05-22T21:46:14Z
Indexed on
2010/05/22
21:50 UTC
Read the original article
Hit count: 208
ruby-on-rails
I'm following the instructions at: http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids to add the tag cloud to my view:
in the controller:
class PostController < ApplicationController
def tag_cloud
@tags = Post.tag_counts
end
end
I also added the tag_cloud
method as a helper method in the controller
and in the view:
<% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %> (line 1)
<%= link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %> (line2)
<% end %> (line 3)
However:
1) if I don't add the helper_method :tag_cloud
in the controller I get a undefined method
error for tag_cloud
2) if I do add the helper method I get: wrong number of arguments (2 for 0)
on the same line 1 of my sample code above.
Suggestions?
© Stack Overflow or respective owner