>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 <[email protected]>
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/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to