Permalink
Browse files

Setup env and seed_loaded for DatabaseTasks outside load_config

Those vars can be used in tasks, which not call load_config.
  • Loading branch information...
1 parent 84fd0aa commit 11ac1e8a2ce9b12fce829088e1000328687d0cf4 @drogus drogus committed Jun 23, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/railtie.rb
@@ -37,11 +37,12 @@ class Railtie < Rails::Railtie # :nodoc:
rake_tasks do
require "active_record/base"
+ ActiveRecord::Tasks::DatabaseTasks.seed_loader = Rails.application
+ ActiveRecord::Tasks::DatabaseTasks.env = Rails.env
+
namespace :db do
task :load_config do
- ActiveRecord::Tasks::DatabaseTasks.env = Rails.env
ActiveRecord::Tasks::DatabaseTasks.db_dir = Rails.application.config.paths["db"].first
- ActiveRecord::Tasks::DatabaseTasks.seed_loader = Rails.application
ActiveRecord::Tasks::DatabaseTasks.database_configuration = Rails.application.config.database_configuration
ActiveRecord::Tasks::DatabaseTasks.migrations_paths = Rails.application.paths['db/migrate'].to_a
ActiveRecord::Tasks::DatabaseTasks.fixtures_path = File.join Rails.root, 'test', 'fixtures'

0 comments on commit 11ac1e8

Please sign in to comment.