Fixes #1915. Only clear the connection pool if it exists

git-svn-id: file:///home/svn/framework3/trunk@9301 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-05-14 15:55:01 +00:00
parent f440317225
commit 10364dc70d
1 changed files with 2 additions and 2 deletions

View File

@ -26,12 +26,12 @@ module DBSave
def self.included(mod) def self.included(mod)
class << mod class << mod
def find(*args) def find(*args)
ActiveRecord::Base.connection_pool.clear_stale_cached_connections! ActiveRecord::Base.connection_pool.clear_stale_cached_connections! if ActiveRecord::Base.connection_pool
super(*args) super(*args)
end end
def save(*args) def save(*args)
ActiveRecord::Base.connection_pool.clear_stale_cached_connections! ActiveRecord::Base.connection_pool.clear_stale_cached_connections! if ActiveRecord::Base.connection_pool
super(*args) super(*args)
end end