# Acts\_as\_taggable, wrong number of arguments

**URL:** <https://www.ruby-forum.com/t/acts-as-taggable-wrong-number-of-arguments/56556>\
**Category:** Rails\
**Created:** [April 1, 2006, 2:52am UTC](https://www.ruby-forum.com/t/acts-as-taggable-wrong-number-of-arguments/56556 "2006-04-01T02:52:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jakub\_N](https://www.ruby-forum.com/u/Jakub_N)\
**Post date:** [April 1, 2006, 2:52am UTC](https://www.ruby-forum.com/t/acts-as-taggable-wrong-number-of-arguments/56556/1 "2006-04-01T02:52:53Z")

</div>

Hello,

When I try:

@tagged\_items = Problem.find\_tagged\_with :all =\> ‘kuba’

or

@tagged\_items = Problem.tags\_count :limit =\> 100

I get this error:

ArgumentError in Volume#index

wrong number of arguments (2 for 3)

RAILS\_ROOT: script/…/config/…  
Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/gems/1.8/gems/acts\_as\_taggable-1.0.4/lib/taggable.rb:244:in  
`add_limit!' /usr/local/lib/ruby/gems/1.8/gems/acts_as_taggable-1.0.4/lib/taggable.rb:244:in`find\_tagged\_with’  
#{RAILS\_ROOT}/app/controllers/volume\_controller.rb:6:in `index’

Is there something I’m doing wrong?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Jakub\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jakub\_N](https://www.ruby-forum.com/u/Jakub_N)\
**Post date:** [April 1, 2006, 3:05am UTC](https://www.ruby-forum.com/t/acts-as-taggable-wrong-number-of-arguments/56556/2 "2006-04-01T03:05:04Z")

</div>

On Sat, 2006-04-01 at 02:50 +0200, Jakub N. wrote:

> `add_limit!' /usr/local/lib/ruby/gems/1.8/gems/acts_as_taggable-1.0.4/lib/taggable.rb:244:in`find\_tagged\_with’  
> #{RAILS\_ROOT}/app/controllers/volume\_controller.rb:6:in `index’
> 
> Is there something I’m doing wrong?

* * *

somewhere in your controller, you’ve got a method…

tagged\_with(1, 2, 3)

tags\_count(1, 2, 3)

but you aren’t supplying the correct number of variables for it to work

Craig

---

<div class="post-metadata">

**Author:** ![Jakub\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jakub\_N](https://www.ruby-forum.com/u/Jakub_N)\
**Post date:** [April 1, 2006, 3:11am UTC](https://www.ruby-forum.com/t/acts-as-taggable-wrong-number-of-arguments/56556/3 "2006-04-01T03:11:07Z")

</div>

Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
} On Sat, 2006-04-01 at 02:50 +0200, Jakub N. wrote:  
} \> Hello,  
} \>  
} \> When I try:  
} \>  
} \> @tagged\_items = Problem.find\_tagged\_with :all =\> ‘kuba’  
} \>  
} \> or  
} \>  
} \> @tagged\_items = Problem.tags\_count :limit =\> 100  
} \>  
} \>  
} \> I get this error:  
} \>  
} \> ArgumentError in Volume#index  
} \>  
} \> wrong number of arguments (2 for 3)  
} \>  
} \> RAILS\_ROOT: script/…/config/…  
} \> Application Trace | Framework Trace | Full Trace  
} \>  
} \>  
/usr/local/lib/ruby/gems/1.8/gems/acts\_as\_taggable-1.0.4/lib/taggable.rb:244:in  
} \> `add_limit!' } > /usr/local/lib/ruby/gems/1.8/gems/acts_as_taggable-1.0.4/lib/taggable.rb:244:in } > `find\_tagged\_with’  
} \> #{RAILS\_ROOT}/app/controllers/volume\_controller.rb:6:in `index’  
} \>  
} \> Is there something I’m doing wrong?  
} ----  
} somewhere in your controller, you’ve got a method…  
}  
} tagged\_with(1, 2, 3)  
}  
} tags\_count(1, 2, 3)  
}  
} but you aren’t supplying the correct number of variables for it to  
work

#find\_tagged\_with and #tags\_count comes from ‘acts\_as\_taggable’ plugin,

according to doc:

tags\_count(options = {})

This method counts the number of times the tags have been applied to  
your objects and, by default, returns a hash in the form of {  
.tag\_name.  
=\> count, . }

so it takes a hash of options

I forgot to say that i’m using rails 1.1 and acts\_as\_taggable 1.0.4  
(gem)

---

<div class="post-metadata">

**Author:** ![Jakub\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3be4f8/32.png) [@Jakub\_N](https://www.ruby-forum.com/u/Jakub_N)\
**Post date:** [April 1, 2006, 6:34am UTC](https://www.ruby-forum.com/t/acts-as-taggable-wrong-number-of-arguments/56556/4 "2006-04-01T06:34:36Z")

</div>

Hi !

2006/3/31, Jakub N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
> } somewhere in your controller, you’ve got a method…  
> }  
> } tagged\_with(1, 2, 3)  
> }  
> } tags\_count(1, 2, 3)  
> }  
> } but you aren’t supplying the correct number of variables for it to work
> 
> #find\_tagged\_with and #tags\_count comes from ‘acts\_as\_taggable’ plugin,

No, that is not the problem. If you look at the stacktrace, you’ll  
see the bug is in the implementation of taggable.rb. Line 244 call  
add\_limit!, which expects 3 arguments, not 2. I had the same problem.  
Either the plugin needs to change or the implementation of add\_limit!  
needs to expect a default argument.

See ticket #4456 for details:  
[http://dev.rubyonrails.org/ticket/4456](http://dev.rubyonrails.org/ticket/4456)

Bye !
