Forum: Ruby on Rails acts_as_taggable, wrong number of arguments

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jakub N. (Guest)
on 2006-04-01 04:52
(Received via mailing list)
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.
Craig W. (Guest)
on 2006-04-01 05:05
(Received via mailing list)
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
Jakub N. (Guest)
on 2006-04-01 05:11
(Received via mailing list)
Craig W. <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)
François B. (Guest)
on 2006-04-01 08:34
(Received via mailing list)
Hi !

2006/3/31, Jakub N. <removed_email_address@domain.invalid>:
> Craig W. <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

Bye !
This topic is locked and can not be replied to.