diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-11-26 22:10:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-11-26 22:10:55 +0000 |
commit | 0a86122a248020081722bf0c12de70c929cbcbd9 (patch) | |
tree | 1cf391cef16aa0f58a44a7958481a79861499813 /railties | |
parent | 4887e53bf9fd9c35acd05a4cc40a014406132ac2 (diff) | |
download | rails-0a86122a248020081722bf0c12de70c929cbcbd9.tar.gz rails-0a86122a248020081722bf0c12de70c929cbcbd9.tar.bz2 rails-0a86122a248020081722bf0c12de70c929cbcbd9.zip |
Only reload connections in development mode that supports (and requires that) -- in other words, only do it for SQLite (closes #6687, #6700) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5637 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/dispatcher.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index ce6f505895..31eb5d2317 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -62,7 +62,7 @@ class Dispatcher Class.remove_class(*Reloadable.reloadable_classes) end - ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord) + ActiveRecord::Base.clear_reloadable_connections! if defined?(ActiveRecord) end # Add a preparation callback. Preparation callbacks are run before every @@ -76,13 +76,16 @@ class Dispatcher def to_prepare(identifier = nil, &block) unless identifier.nil? callback = preparation_callbacks.detect { |ident, _| ident == identifier } + if callback # Already registered: update the existing callback callback[-1] = block return end end + preparation_callbacks << [identifier, block] - nil + + return end private |