From the AWDWR book: "If you pass a symbol to establish_connection,
[...]". Maybe you need to convert your string to a symbol?
establish_connection "users_#{RAILS_ENV}".to_sym
Pepe
On May 21, 11:13 am, Arfon Smith
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I have a separate DB for one model in my application and in development
> mode the connection is working properly, in production however it
isn''t.
>
> production:
> adapter: mysql
> host: myhost
> username: root
> password:
> database: production_db
>
> users_production:
> adapter: mysql
> host: myhost
> username: root
> password:
> database: other_db
>
> The model that connects to the other database is called User but the
> table it references in other_db is smf_users so my User.rb looks like
> this:
>
> class User < ActiveRecord::Base
> establish_connection "users_#{RAILS_ENV}"
> set_table_name "smf_users"
> end
>
> In production I''m getting this error:
>
> Mysql::Error: Table ''production_db. smf_users''
doesn''t exist:
>
> Note how it is trying to connect to the wrong database and so
isn''t
> finding the correct table. As I say, this works in development mode.
>
> Any suggestions?
> --
> Posted viahttp://www.ruby-forum.com/.