# Tag clouds

**URL:** <https://www.ruby-forum.com/t/tag-clouds/155211>\
**Category:** Rails\
**Created:** [December 9, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211 "2008-12-09T12:56:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 9, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211/1 "2008-12-09T12:56:05Z")

</div>

I was working through the simply rails book, i have completed up to  
chapter 10,  
now i want to add tag clouds to the welcome page ? how to do it ?

I have installed acts\_as\_taggable\_on\_steroids plugin from here  
[http://svn.viney.net.nz/things/rails/plugins/acts\_as\_taggable\_on\_steroids](http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids)

I was going through their readme file as per the readme file i did the  
following changes

1. in app/helpers/application\_helper.rb file

module ApplicationHelper

```
include TagsHelper

```

end

1. class StoriesController \< ApplicationController

2. in app/views/stories/index.html.erb file i have added

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

1. in /public/stylesheets/style.css

i have added

.css1 { font-size: 1.0em; }

.css2 { font-size: 1.2em; }

.css3 { font-size: 1.4em; }

.css4 { font-size: 1.6em; }

after doing all these when i access [http://0.0.0.0:3000/stories/](http://0.0.0.0:3000/stories/)

i am getting the error message as

undefined method `tag\_cloud’ for #ActionView::Base:0xb5879a78

can anyone help me to correct this error ?

---

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 9, 2008, 1:27pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211/2 "2008-12-09T13:27:18Z")

</div>

You are trying to use a controller method like a helped method. Try  
moving the method to applicationhelper and seeing if that works

On 09/12/2008, at 21:56, Sulekha Mariam  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 9, 2008, 1:45pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211/3 "2008-12-09T13:45:33Z")

</div>

Ryan B. wrote:

> You are trying to use a controller method like a helped method. Try  
> moving the method to applicationhelper and seeing if that works

you mean moving

def tag\_cloud

@tags = Story.tag\_counts

end

to app/helpers/application\_helper.rb

---

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 9, 2008, 3:05pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211/4 "2008-12-09T15:05:20Z")

</div>

On Tuesday 09 December 2008 10:49:24 Sulekha Mariam wrote:

> Sulekha Mariam wrote:  
> […]
> 
> > def tag\_cloud

[…]

> now i am getting the error
> 
> Showing stories/index.html.erb where line #4 raised:
> 
> wrong number of arguments (2 for 0)

Your method accepts no argument. Try something like:

def tag\_cloud(args\*)

I don’t remember if this is the correct syntax. Search for  
it. 🙂

## HTH,

## Davi V.

E-mail: davividal arroba siscompar ponto com ponto br  
MSN : davividal arroba msn ponto com  
GTalk : davividal arroba gmail ponto com  
Skype : davividal  
YIM : davi\_vidal  
ICQ : 138815296

---

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 9, 2008, 1:49pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211/5 "2008-12-09T13:49:24Z")

</div>

Sulekha Mariam wrote:

> Ryan B. wrote:
> 
> > You are trying to use a controller method like a helped method. Try  
> > moving the method to applicationhelper and seeing if that works
> 
> you mean moving
> 
> def tag\_cloud
> 
> @tags = Story.tag\_counts
> 
> end
> 
> to app/helpers/application\_helper.rb

i moved tag\_cloud method from StoriesController to  
app/helpers/application\_helper.rb

now i am getting the error

Showing stories/index.html.erb where line #4 raised:

wrong number of arguments (2 for 0)

---

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 11, 2008, 6:59am UTC](https://www.ruby-forum.com/t/tag-clouds/155211/6 "2008-12-11T06:59:47Z")

</div>

thanks a lot, but can you give ideas/pointers as on how to implement the  
tag cloud given in the following page using rails

> **[Lanmap - handy tool to map your Local Area Network (LAN) automatically -...](https://blog.mypapit.net/2007/09/lanmap-handy-tool-to-map-your-local-area-network-lan-automatically.html)**
>
> I discovered lanmap during my stay in a hotel during the Merdeka holidays. This little handy tool can generate local area network map in PNG,SVG and GIF format by listening to network traffic from network interfaces. lanmap does this by putting...

---

<div class="post-metadata">

**Author:** ![annalissa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@annalissa](https://www.ruby-forum.com/u/annalissa)\
**Post date:** [December 10, 2008, 4:17pm UTC](https://www.ruby-forum.com/t/tag-clouds/155211/7 "2008-12-10T16:17:27Z")

</div>

On Tuesday 09 December 2008 12:03:55 Davi V. wrote:

> > Showing stories/index.html.erb where line #4 raised:
> > 
> > wrong number of arguments (2 for 0)
> 
> Your method accepts no argument. Try something like:
> 
> def tag\_cloud(args\*)

irb(main):001:0\> def foo(\*args)  
irb(main):002:1\> puts args  
irb(main):003:1\> end  
=\> nil  
irb(main):004:0\> foo “hello”  
hello  
=\> nil  
irb(main):005:0\> foo “hello”, “world”  
hello  
world  
=\> nil  
irb(main):006:0\> foo “hello”, “world”, “I’m alive”  
hello  
world  
I’m alive  
=\> nil

## HTH,

## Davi V.

E-mail: davividal arroba siscompar ponto com ponto br  
MSN : davividal arroba msn ponto com  
GTalk : davividal arroba gmail ponto com  
Skype : davividal  
YIM : davi\_vidal  
ICQ : 138815296
