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:in
`load_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:in `new_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:in `require_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:in `const_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:in `constantize'
    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:in `constantize'
    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:in `observed_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:in `initialize'
    C:/Ruby/lib/ruby/1.8/singleton.rb:94:in `new'
    C:/Ruby/lib/ruby/1.8/singleton.rb:94:in `instance'
    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:in `each'
    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:in `define_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:in `evaluate_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:in `run'
    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:in `send'
    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:in `run_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:in `run_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:in `call'
    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:in
`call'
    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:in
`call'
    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:in `call'
    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:in
`each'
    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:in `call'
    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:in `call'
    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:in `process_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:in `process_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:in `initialize'
    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:in `run'
    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:in `new'
    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:in `run'
    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:in
`require'
    ./script/server:3
    -e:2:in `load'
    -e:2


Any help appreciated,

Thanks,

Dan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to