Permalink
Browse files

Don't load observers if Active Record isn't loaded.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6819 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a11374a commit f78a1948d267ebacff381507980e1f331ad4a3fb @jeremy jeremy committed May 23, 2007
Showing with 8 additions and 5 deletions.
  1. +8 −5 railties/lib/initializer.rb
@@ -216,7 +216,9 @@ def load_environment
end
def load_observers
- ActiveRecord::Base.instantiate_observers
+ if configuration.frameworks.include?(:active_record)
+ ActiveRecord::Base.instantiate_observers
+ end
end
# This initialzation sets $KCODE to 'u' to enable the multibyte safe operations.
@@ -231,9 +233,10 @@ def initialize_encoding
# this sets the database configuration from Configuration#database_configuration
# and then establishes the connection.
def initialize_database
- return unless configuration.frameworks.include?(:active_record)
- ActiveRecord::Base.configurations = configuration.database_configuration
- ActiveRecord::Base.establish_connection
+ if configuration.frameworks.include?(:active_record)
+ ActiveRecord::Base.configurations = configuration.database_configuration
+ ActiveRecord::Base.establish_connection
+ end
end
# If the +RAILS_DEFAULT_LOGGER+ constant is already set, this initialization
@@ -690,4 +693,4 @@ def find_pair(key)
self.each { |i| return i if i.first == key }
return false
end
-end
+end

0 comments on commit f78a194

Please sign in to comment.