Join GitHub today
Using ActiveRecord Rake tasks out of Rails #11609
Here's a snippet of the Rakefile:
require 'rake' require 'active_record' include ActiveRecord::Tasks DatabaseTasks.database_configuration = YAML::load(File.open('./config/database.yml')) DatabaseTasks.db_dir = 'db' DatabaseTasks.create_current(ENV['RACK_ENV'])
And I get the following error when running
database configuration does not specify adapter /Users/xav/code/ruby/incase/server2/Rakefile:7:in `<top (required)>'
I (think I) have read carefully the doc in https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/connection_specification.rb though.
After some quick investigation, it appears that the line 52 of
raise(AdapterNotSpecified, "database configuration does not specify adapter") unless spec.key?(:adapter)
What do you think? Is that a PEBKAC or a bug?
You're apparently just not defining the configuration at the right place.
Damien is right about providing the configuration. I intentionally left out
Here is the gist with an example Rakefile, which you could use to run AR
I started adding info about it in the AR guide, I will push it later today.
On Fri, Jul 26, 2013 at 11:54 AM, Michael Nikitochkin <