21 Mar 2012, 03:28
Generic-user-small

Tink Dubrot (3 posts)

Hi folks,

I’m getting an error in Chapter 5 that I just can’t track down on page 91, just after adding the setup method to test/test_helper.rb (“After this change, our test suit is green!”)

When I run rake test, I get the error below. Furthermore, I get the same complaint (without the stack trace) running rake db:migrate from dummy. Here’s what I’ve tried so far to solve it:

  • After realising I couldn’t spot anything, I rewrote the program from scratch. Same error

  • I reverted from 1.9.3/3.2 to 1.9.2/3.0.2 w/a new gemset to see if it had something to do with versions. Same error.

  • Checked mongo was working OK. Seems to be.

Any ideas appreciated - I’m completely stumped.

Cheers…

     /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/bson-1.6.1/lib/bson/types/object_id.rb:48:in `generate': ArgumentError: wrong number of arguments(1 for 0):
     SELECT name (ActiveRecord::StatementInvalid)
     FROM sqlite_master
     WHERE type = 'table' AND NOT name = 'sqlite_sequence'
    from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/bson-1.6.1/lib/bson/types/object_id.rb:48:in `initialize'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/keys.rb:277:in `new'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/keys.rb:277:in `default_id_value'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/keys.rb:163:in `initialize'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/dirty.rb:44:in `initialize'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/sci.rb:26:in `initialize'
from /Users/john/Manuals/Rails/Crafting Rails/Chap5/sql_metrics/lib/sql_metrics/metric.rb:13:in `new'
from /Users/john/Manuals/Rails/Crafting Rails/Chap5/sql_metrics/lib/sql_metrics/metric.rb:13:in `store!'
from /Users/john/Manuals/Rails/Crafting Rails/Chap5/sql_metrics/lib/sql_metrics.rb:8:in `block in <top (required)>'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activesupport-3.0.12/lib/active_support/notifications/fanout.rb:47:in `call'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activesupport-3.0.12/lib/active_support/notifications/fanout.rb:47:in `publish'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activesupport-3.0.12/lib/active_support/notifications/fanout.rb:25:in `block in publish'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activesupport-3.0.12/lib/active_support/notifications/fanout.rb:25:in `each'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activesupport-3.0.12/lib/active_support/notifications/fanout.rb:25:in `publish'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activesupport-3.0.12/lib/active_support/notifications/instrumenter.rb:26:in `instrument'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in `execute'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/connection_adapters/sqlite_adapter.rb:180:in `tables'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/connection_adapters/abstract/schema_statements.rb:21:in `table_exists?'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/connection_adapters/abstract/schema_statements.rb:425:in `initialize_schema_migrations_table'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/migration.rb:489:in `initialize'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/migration.rb:435:in `new'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/migration.rb:435:in `up'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/activerecord-3.0.12/lib/active_record/migration.rb:417:in `migrate'
from /Users/john/Manuals/Rails/Crafting Rails/Chap5/sql_metrics/test/test_helper.rb:19:in `<top (required)>'
from /Users/john/Manuals/Rails/Crafting Rails/Chap5/sql_metrics/test/integration/navigation_test.rb:1:in `require'
from /Users/john/Manuals/Rails/Crafting Rails/Chap5/sql_metrics/test/integration/navigation_test.rb:1:in `<top (required)>'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /Users/john/.rvm/gems/ruby-1.9.2-p290@crafting/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
    rake aborted!
21 Mar 2012, 06:23
Generic-user-small

Tink Dubrot (3 posts)

…aand in typical fashion, I solved it shortly afterwards. In case anyone else runs into a similar issue:

I never quite tracked down the explicit error, but my understanding is that the version of bson specified in the book (1.1.5) doesn’t quite gel with more modern versions of mongo. I took out the version specifications for mongo, mongo_mapper and bson, ran ‘bundle update’, and everything works fine.

22 Oct 2012, 03:00
Generic-user-small

Washington Luiz (1 post)

thanks for that last comment

  You must be logged in to comment