lib/simple_admin/engine.rb in simple_admin-0.1.0 vs lib/simple_admin/engine.rb in simple_admin-0.2.1

- old
+ new

@@ -2,7 +2,19 @@ require 'rails' module SimpleAdmin class Engine < Rails::Engine isolate_namespace SimpleAdmin + initializer 'simple_admin' do + if Rails.env == "development" + simple_admin_reloader = ActiveSupport::FileUpdateChecker.new(Dir["app/admin/**/*"], true) do + SimpleAdmin.unregister + Rails.application.reload_routes! + end + + ActionDispatch::Callbacks.to_prepare do + simple_admin_reloader.execute_if_updated + end + end + end end end