Module: RailsEnvSwitcher::Switcher::Reloader

Defined in:
lib/rails-env-switcher/switcher/reloader.rb

Class Method Summary collapse

Class Method Details

.switch_env(old_env, env, options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/rails-env-switcher/switcher/reloader.rb', line 2

def self.switch_env(old_env, env, options={})
  if options[:reload]
    unless Rails.application.config.cache_classes
      ActionDispatch::Reloader.cleanup!
      ActionDispatch::Reloader.prepare!
    end
    FactoryGirl.reload if defined?(FactoryGirl)
  end
end