mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't reference Rails.application from inside a component
This commit is contained in:
parent
5bdeb9bfd7
commit
60b53e9883
2 changed files with 8 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -39,6 +39,8 @@ module ActionDispatch
|
|||
config.action_dispatch.always_write_cookie = Rails.env.development? if config.action_dispatch.always_write_cookie.nil?
|
||||
ActionDispatch::Cookies::CookieJar.always_write_cookie = config.action_dispatch.always_write_cookie
|
||||
|
||||
ActionDispatch::Reloader.default_reloader = app.reloader
|
||||
|
||||
ActionDispatch.test_app = app
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue