In my production environment I have 1 server running as mainappserver (
ex. ) ( Rails + Apache2 + Mysql ) and during heavy periods
we startup a second application server that just handle the Rails
application calls.

The second application server ( ex. ) connects to the mysql
of the mainappserver as specified in the database.yml :

adapter: mysql2
database: appname
username: appuser
password: password
encoding: utf8
reconnect: true

Now everytime I'm running a rake tasks or a rails command ( ex. rails
console production ) I get the following error :

Access denied for user 'appuser'@'' (using password: YES)

It is strange that he is not connecting to the database specified in the
database.yml file. After some research I figured out that one of my
custom plugins is causing the problem. The problem is comming from the
initializer of the plugin where I do :

require "#{File.dirname(__FILE__)}/lib/fianet_order"

config.to_prepare do
if AppConfig.fianet.enabled

We need to use the config.to_prepare because we want that it only loads
1 time when it is the production environment and reload everytime in
development mode. In load_fianet we do a class_eval on a model to add
some specific methods.

If I delete this code, the rake tasks and rails commands are working
fine. How does it come that he is not taking the normal database.yml at
this point? It is for the moment also unclear from where he gets the host address to connect to. It is nowhere specified.

Posted via

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
To unsubscribe from this group, send email to
For more options, visit this group at

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedDec 22, '11 at 9:01a
activeDec 22, '11 at 9:01a

1 user in discussion

Dries Steenhouwer: 1 post



site design / logo © 2021 Grokbase