lib/groonga_client_model/railtie.rb in groonga-client-model-0.9.9 vs lib/groonga_client_model/railtie.rb in groonga-client-model-1.0.0
- old
+ new
@@ -50,11 +50,18 @@
end
end
initializer "groonga_client_model.set_reloader_hooks" do
ActiveSupport.on_load(:groonga_client_model) do
- ActiveSupport::Reloader.before_class_unload do
- GroongaClientModel::Record.clear_cache
+ if ActiveSupport.const_defined?(:Reloader)
+ ActiveSupport::Reloader.before_class_unload do
+ GroongaClientModel::Record.clear_cache
+ end
+ else
+ # For Rails < 5
+ ActionDispatch::Reloader.to_cleanup do
+ GroongaClientModel::Record.clear_cache
+ end
end
end
end
initializer "groonga_client_model.set_configs" do |app|