Class: ActiveAdmin::Reloader
Overview
Deals with reloading Active Admin on each request in development and once in production.
Instance Method Summary collapse
-
#attach! ⇒ Object
Attach to Rails and perform the reload on each request.
-
#initialize(rails_version) ⇒ Reloader
constructor
A new instance of Reloader.
- #reloader_class ⇒ Object
Constructor Details
#initialize(rails_version) ⇒ Reloader
Returns a new instance of Reloader.
9 10 11 |
# File 'lib/active_admin/reloader.rb', line 9 def initialize(rails_version) @rails_version = rails_version.to_s end |
Instance Method Details
#attach! ⇒ Object
Attach to Rails and perform the reload on each request.
14 15 16 17 18 19 |
# File 'lib/active_admin/reloader.rb', line 14 def attach! reloader_class.to_prepare do ActiveAdmin.application.unload! Rails.application.reload_routes! end end |
#reloader_class ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/active_admin/reloader.rb', line 21 def reloader_class if @rails_version[0..2] == '3.1' ActionDispatch::Reloader else ActionDispatch::Callbacks end end |