Forum: Ruby on Rails active record query_cache error -- 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.
A434690363304b6d3cef7b537196f7e1?d=identicon&s=25 chazen@gmail.com (Guest)
on 2007-02-19 04:20
(Received via mailing list)
Hi,

I'm getting the same error in query_cache.rb:75 (wrong number of
arguments) while attempting to do either of two things - a database
migration, or run a functional test on a controller.  I am running
rails revision 6168, and the error might be related to installed
ezcrypto (revision 68), but removing all references to ezcrypto in my
app does not make the problem go away.

Does anyone have suggestions as to how I might better figure out what
the problem is?  I have spent literally hours on this.  Reading the
source for query_cache.rb seems to indicate that the failure is
happening while Rails is selecting between cached active record
queries and queries without caches.  There are no files in tmp/cache.

Here is a full output of the error:

$ rake db:migrate VERSION=0 --trace
(in /home/tc1/rails/cg)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddRootUser: reverting
=====================================================
rake aborted!
wrong number of arguments (0 for 2)
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/query_cache.rb:75:in `hash'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/query_cache.rb:75:in `connection'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/base.rb:512:in `delete_all'
./db/migrate//017_add_root_user.rb:20:in `down_without_benchmarks'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/migration.rb:212:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/migration.rb:212:in `migrate'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/migration.rb:334:in `migrate'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/migration.rb:329:in `migrate'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/migration.rb:300:in `down'
/home/tc1/rails/cg/config/../vendor/rails/activerecord/lib/
active_record/migration.rb:289:in `migrate'
/home/tc1/rails/cg/config/../vendor/rails/railties/lib/tasks/
databases.rake:4
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/usr/bin/rake:16

cheers!!!
Charlie
A434690363304b6d3cef7b537196f7e1?d=identicon&s=25 chazen@gmail.com (Guest)
on 2007-02-19 16:13
(Received via mailing list)
On Feb 18, 10:20 pm, "cha...@gmail.com" <cha...@gmail.com> wrote:
> Hi,
>
> I'm getting the same error in query_cache.rb:75 (wrong number of
> arguments) while attempting to do either of two things - a database
> migration, or run a functional test on a controller.

I figured it out.  In my model, I had a method named "hash", which
accidentally overrode the built-in "hash", breaking everything.  My
mistake!

-charlie
This topic is locked and can not be replied to.