Browse files

only clear caches if we are actually connected to the database

  • Loading branch information...
1 parent 5287d36 commit 85cc7122bab1cfec661fdfe3bf4738d9fba55399 @tenderlove tenderlove committed Nov 12, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 activerecord/lib/active_record/railtie.rb
View
6 activerecord/lib/active_record/railtie.rb
@@ -149,8 +149,10 @@ class Railtie < Rails::Railtie # :nodoc:
ActiveSupport.on_load(:active_record) do
ActionDispatch::Reloader.send(hook) do
- ActiveRecord::Base.clear_reloadable_connections!
- ActiveRecord::Base.clear_cache!
+ if ActiveRecord::Base.connected?
+ ActiveRecord::Base.clear_reloadable_connections!
+ ActiveRecord::Base.clear_cache!
+ end
end
end
end

0 comments on commit 85cc712

Please sign in to comment.