James Hughes
2005-Oct-27 23:16 UTC
Skipping framework in new initializer doesn''t skip framework
Hi, rails-0.14.2/lib/initializer.rb states: # This initialization routine does nothing unless <tt>:active_record</tt> # is one of the frameworks to load (Configuration#frameworks). If it is, # this sets the database configuration from Configuration#database_configuration # and then establishes the connection. def initialize_database # code end In environment.rb, I have this code in the block passed to Rails::Initializer.run: # Skip frameworks you''re not going to use config.frameworks -= [ :action_web_service, :action_mailer, :active_record ] I have tested (with a puts) that the frameworks array in initialize_database is indeed missing active_record, which means no call to establish connection should ever happen. Behold: script/server /usr/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:52:in `establish_connection'': development database is not configured (ActiveRecord::AdapterNotSpecified) from /usr/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in `establish_connection'' (Aside: If you''re wondering why I''m trying to suppress loading of active_record, it''s because I''m using active_ldap for the models.) Just for fun, I did the same thing to an app that does have a db behind it, and got, as expected, ActiveRecord::ConnectionNotEstablished on login attempt. I upgraded to 0.14.2 yesterday and did ''rails trunk'' on both apps, so I suspect that something went wrong with that process on the first app (the ldap one). If anyone can see what that might be, let me know.. jh -- James Hughes Web application developer Centre for Health Services and Policy Research Vancouver, BC
Possibly Parallel Threads
- Re: Skipping framework in new initializer doesn't skip framework - IGNORE
- Getting AdapterNotSpecified on simple script/generate
- unable to figure out how to get backgroundrb.yml to be used when starting backgroundrb
- Postgresql connection problems
- after_fork - ActiveRecord::AdapterNotSpecified