# Active record query\_cache error -- wrong number of arguments

**URL:** <https://www.ruby-forum.com/t/active-record-query-cache-error-wrong-number-of-arguments/86021>\
**Category:** Rails\
**Created:** [February 19, 2007, 4:20am UTC](https://www.ruby-forum.com/t/active-record-query-cache-error-wrong-number-of-arguments/86021 "2007-02-19T04:20:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 19, 2007, 4:20am UTC](https://www.ruby-forum.com/t/active-record-query-cache-error-wrong-number-of-arguments/86021/1 "2007-02-19T04:20:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 19, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/active-record-query-cache-error-wrong-number-of-arguments/86021/2 "2007-02-19T16:13:59Z")

</div>

On Feb 18, 10:20 pm, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto: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
