Active record query_cache error -- wrong number of arguments


#1

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:inconnection’
/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:indown_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:inmeasure’
/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:inmigrate’
/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:indown’
/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:inexecute’
/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:ininvoke’
/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:ininvoke’
/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:inrun’
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/usr/bin/rake:16

cheers!!!
Charlie


#2

On Feb 18, 10:20 pm, “removed_email_address@domain.invalid” removed_email_address@domain.invalid 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