Commit a368d61a06eb2dc16ad8bd32b57f4324e75249f9
1 parent
b9800000
Exists in
master
and in
29 other branches
Fixes multitenancy rake tasks
- Fixes a typo; - Loads the environment first so ActiveRecord is available.
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
lib/tasks/multitenancy.rake
1 | namespace :multitenancy do | 1 | namespace :multitenancy do |
2 | 2 | ||
3 | - task :create do | 3 | + task :create => :environment do |
4 | db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } | 4 | db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } |
5 | cd Rails.root.join('config', 'environments'), :verbose => true | 5 | cd Rails.root.join('config', 'environments'), :verbose => true |
6 | - file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}" | 6 | + file_envs = Dir.glob "{*_development.rb,*_production.rb,*_test.rb}" |
7 | (db_envs.map{ |e| e + '.rb' } - file_envs).each { |env| ln_s env.split('_').last, env } | 7 | (db_envs.map{ |e| e + '.rb' } - file_envs).each { |env| ln_s env.split('_').last, env } |
8 | end | 8 | end |
9 | 9 | ||
10 | - task :remove do | 10 | + task :remove => :environment do |
11 | db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } | 11 | db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } |
12 | cd Rails.root.join('config', 'environments'), :verbose => true | 12 | cd Rails.root.join('config', 'environments'), :verbose => true |
13 | - file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}" | 13 | + file_envs = Dir.glob "{*_development.rb,*_production.rb,*_test.rb}" |
14 | (file_envs - db_envs.map{ |e| e + '.rb' }).each { |env| safe_unlink env } | 14 | (file_envs - db_envs.map{ |e| e + '.rb' }).each { |env| safe_unlink env } |
15 | end | 15 | end |
16 | 16 |