Establish_connection issues

Hi,

I have created a new app but I would like to use some database tables
from another application - so I am trying to use establish_connection

Here is my code…

Model file

class User < ActiveRecord::Base
establish_connection :external_database_development

Database.yml


standard configurations that will run the rest of the app

external_database_development:
adapter: postgresql
database: name_of_db
username: postgres
password: mypass
host: localhost
port: 2810

When I try and load my app I get a 500 error.

Status: 500 Internal Server Error
external_database_development database is not configured
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
62:in establish_connection' C:/Users/incubator10/My Documents/Aptana Studio Workspace/ graduate_toolbox_dev/app/models/user.rb:3 C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/dependencies.rb:380:inload_without_new_constant_marking’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:380:in load_file' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/dependencies.rb:521:innew_constants_in’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:379:in load_file' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/dependencies.rb:259:inrequire_or_load’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:425:in load_missing_constant' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/dependencies.rb:80:inconst_missing’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:92:in const_missing' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/inflector.rb:361:inconstantize’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/inflector.rb:360:in each' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/inflector.rb:360:inconstantize’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/string/inflections.rb:162:in constantize' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/observer.rb:157:inobserved_class’
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/observer.rb:183:in observed_classes' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/observer.rb:166:ininitialize’
C:/Ruby/lib/ruby/1.8/singleton.rb:94:in new' C:/Ruby/lib/ruby/1.8/singleton.rb:94:ininstance’
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/observer.rb:38:in instantiate_observers' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/ active_record/observer.rb:36:ineach’
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/observer.rb:36:in instantiate_observers' C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/ action_controller/dispatcher.rb:16:indefine_dispatcher_callbacks’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/callbacks.rb:182:in call' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/callbacks.rb:182:inevaluate_method’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/callbacks.rb:166:in call' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/callbacks.rb:90:inrun’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/callbacks.rb:90:in each' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/callbacks.rb:90:insend’
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/callbacks.rb:90:in run' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_support/callbacks.rb:276:inrun_callbacks’
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/dispatcher.rb:52:in send' C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/ action_controller/dispatcher.rb:52:inrun_prepare_callbacks’
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/dispatcher.rb:57:in reload_application' C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/ action_controller/reloader.rb:8:incall’
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/failsafe.rb:11:in call' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:incall’
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in
synchronize' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:incall’
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
action_controller/dispatcher.rb:106:in call' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/ static.rb:31:incall’
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:46:in
call' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:ineach’
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in
call' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/ log_tailer.rb:17:incall’
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/
content_length.rb:13:in call' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/chunked.rb: 15:incall’
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/
mongrel.rb:61:in process' C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/ mongrel.rb:159:inprocess_client’
C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/
mongrel.rb:158:in each' C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/ mongrel.rb:158:inprocess_client’
C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/
mongrel.rb:285:in run' C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/ mongrel.rb:285:ininitialize’
C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/
mongrel.rb:285:in new' C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/ mongrel.rb:285:inrun’
C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/
mongrel.rb:268:in initialize' C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/ mongrel.rb:268:innew’
C:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/
mongrel.rb:268:in run' C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/ mongrel.rb:34:inrun’
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:
111
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
./script/server:3
-e:2:in `load’
-e:2

Any help appreciated,

Thanks,

Dan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs