eladmeidar / rails_indexes

A rake task to track down missing database indexes. does not assume that all foreign keys end with the convention of _id.
http://blog.eizesus.com/2009/9/find-where-to-index-your-tables-on-a-rails-app/
MIT License
489 stars 35 forks source link

undefined method `index_list` #1

Closed lapluviosilla closed 15 years ago

lapluviosilla commented 15 years ago

When I try to run the "db:show_me_some_indexes" task I get the following error: rake aborted! undefined method `index_list' for Indexer:Module

I'm using rails 2.3.4

Rake trace:

Invoke db:show_me_some_indexes (first_time)
Invoke environment (first_time) 
Execute environment
** Invoke db:show_me_some_indexes (first_time)
** Invoke environment (first_time)
** Execute environment
Loading haml-edge gem.
** Execute db:show_me_some_indexes
rake aborted!
undefined method `index_list' for Indexer:Module
/Users/paul/Documents/Projects/msvngit/rails/vendor/plugins/rails_indexes/tasks/indexer.rake:11
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/local/bin/rake:19:in `load'
/opt/local/bin/rake:19
eladmeidar commented 15 years ago

mmm, that's odd, there is no such variable/method in all of the plugin code... can you run the rake task with --trace so i would be able to see where exactly is the error?

lapluviosilla commented 15 years ago

Just added rake trace. The line where it breaks "Indexer.index_list" is in the tasks/indexer.rake file.

Thanks for the quick response BTW!

lapluviosilla commented 15 years ago

It's a typo. Should be "indexes_list" instead of "index_list". I just forked/fixed/pushed and sent you a pull request

eladmeidar commented 15 years ago

np. well, silly me. i deprecated this code on the last commit, but forgot to deprecate the task it self. re-pull the latest master and run one of the other tasks.

lapluviosilla commented 15 years ago

That works out just fine. Thx!

eladmeidar commented 15 years ago

Do you see any use of keeping this option alive? it's just a simple report that i am afraid is useful for almost nothing. the other rake tasks generate a migration code that you can actually use (and change).

lapluviosilla commented 15 years ago

I think a simple report would be more readable and helpful, but the current simple report is actually a bit misleading. It just lists a bunch of columns on the different tables, but some of the indexes recommended by the other tasks actually create composite indexes, etc. So there's no way of telling from the "simple report" what you should do.

eladmeidar commented 15 years ago

Ok, i will keep that in mind.. i generally want to merge the other 2 rake tasks into one that gathers association foreign keys and the finds.

also, i would love to hear if you found it useful in your applications.