ActiveRecord::AdapterNotSpecified when loading merb_env from rake task
Reported by Tom | March 29th, 2008 @ 02:57 PM | in 0.9.4
Apologies if this is in the wrong project - I wasn't sure whether it should be in core or more.
I've built a rake task which imports to my database from XML. I'm using ActiveRecord.
When loading merb_env, it throws up the following error:
tombook:pubsnearby tom$ rake pubsnearby:import --trace
(in /Users/tom/Documents/Projects/Web/pubsnearby)
** Invoke pubsnearby:import (first_time)
** Invoke merb_env (first_time)
** Execute merb_env
~ Loaded RAKE Environment...
~ loading gem 'merb_activerecord' from rakefile:24 ...
~ loading gem 'activerecord' from rakefile:24 ...
~ loading gem 'merb_activerecord' from rakefile:24 ...
rake aborted!
ActiveRecord::AdapterNotSpecified
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:207:in `establish_connection'
/Library/Ruby/Gems/1.8/gems/merb_activerecord-0.9.2/lib/merb/orms/active_record/connection.rb:60:in `connect'
/Library/Ruby/Gems/1.8/gems/merb_activerecord-0.9.2/lib/merb_activerecord.rb:11:in `run'
/Library/Ruby/Gems/1.8/gems/merb-core-0.9.2/lib/merb-core/bootloader.rb:67:in `run'
/Library/Ruby/Gems/1.8/gems/merb-core-0.9.2/lib/merb-core/server.rb:42:in `start'
/Library/Ruby/Gems/1.8/gems/merb-core-0.9.2/lib/merb-core.rb:29:in `start'
/Library/Ruby/Gems/1.8/gems/merb-core-0.9.2/lib/merb-core.rb:39:in `start_environment'
/Users/tom/Documents/Projects/Web/pubsnearby/rakefile:24
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:518:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `send'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:515:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:507:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
The database is correctly configured, and works from IRB.
Comments and changes to this ticket
-

Jarrod Spillers April 9th, 2008 @ 05:24 PM
I can confirm a similar problem happening when trying to do the same thing using Datamapper as the ORM
-
jack dempsey (jackdempsey) April 9th, 2008 @ 07:57 PM
Yep, me as well on a debian box. Haven't had a chance to isolate differences between it and what i think is working locally on my macbook. Might be related, maybe not...
-
Ezra Zygmuntowicz April 18th, 2008 @ 12:25 AM
- → State changed from new to open
- → Assigned user changed from to Fabien Franzen (loob2)
-
Michael Klishin (antares) May 11th, 2008 @ 03:10 PM
- → Milestone changed from to 0.9.4
-

Fabien Franzen (loob2) May 15th, 2008 @ 11:24 AM
- → State changed from open to resolved
From version 0.9.3 and onwards this should be OK. Note that by design (and default) rake tasks run in a special environment called 'rake', which you can override from the command line using MERB_ENV=development for example. If you'd like to point your database.yml rake environment to your development environment by default, you can do it like this:
--- # This is a sample database file for the ActiveRecord ORM :development: &defaults :adapter: mysql :database: application_dev :username: :host: localhost :encoding: utf8 :rake: <<: *defaults
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
