aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2013-06-23 16:26:20 +0200
committerPiotr Sarnacki <drogus@gmail.com>2013-06-23 16:26:22 +0200
commit11ac1e8a2ce9b12fce829088e1000328687d0cf4 (patch)
tree4a4770823bdb84aa07cf671e83006a3a561c1d90
parent84fd0aada42c01abf40424fea5b32df64c597d97 (diff)
downloadrails-11ac1e8a2ce9b12fce829088e1000328687d0cf4.tar.gz
rails-11ac1e8a2ce9b12fce829088e1000328687d0cf4.tar.bz2
rails-11ac1e8a2ce9b12fce829088e1000328687d0cf4.zip
Setup env and seed_loaded for DatabaseTasks outside load_config
Those vars can be used in tasks, which not call load_config.
-rw-r--r--activerecord/lib/active_record/railtie.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index 38b1fcb206..afb0be7b74 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -37,11 +37,12 @@ module ActiveRecord
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'