diff options
author | Matthew Draper <matthew@trebex.net> | 2016-03-01 10:04:05 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-03-02 02:14:54 +1030 |
commit | 60b53e9883bfd9f4edb640dbe2de89227b875e09 (patch) | |
tree | 5a9b71599660d575942f6b03b01b977ad4b204f2 /actionpack/lib/action_dispatch/middleware | |
parent | 5bdeb9bfd72a97ad578efc6cce95283f589f1555 (diff) | |
download | rails-60b53e9883bfd9f4edb640dbe2de89227b875e09.tar.gz rails-60b53e9883bfd9f4edb640dbe2de89227b875e09.tar.bz2 rails-60b53e9883bfd9f4edb640dbe2de89227b875e09.zip |
Don't reference Rails.application from inside a component
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/reloader.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb index e5cc588bd6..112bde6596 100644 --- a/actionpack/lib/action_dispatch/middleware/reloader.rb +++ b/actionpack/lib/action_dispatch/middleware/reloader.rb @@ -33,26 +33,22 @@ module ActionDispatch end def self.prepare! - if defined? Rails.application.reloader - Rails.application.reloader.prepare! - else - ActiveSupport::Reloader.prepare! - end + default_reloader.prepare! end def self.cleanup! - if defined? Rails.application.reloader - Rails.application.reloader.reload! - else - ActiveSupport::Reloader.reload! - end + default_reloader.reload! end class << self + attr_accessor :default_reloader # :nodoc: + deprecate to_prepare: 'use ActiveSupport::Reloader.to_prepare instead', to_cleanup: 'use ActiveSupport::Reloader.to_complete instead', prepare!: 'use Rails.application.reloader.prepare! instead', cleanup!: 'use Rails.application.reloader.reload! instead of cleanup + prepare' end + + self.default_reloader = ActiveSupport::Reloader end end |