I am not an experienced Rails developer developing a Rails v2.3 application with MySQl v5.1.
I am not sure how to achieve the following:
I need to create:
1. A new environment (a new environment, in addition to development , production and test ) with the name of a special environment
2. The new database environment for the special environment created above, what I did is add the following to config / database.yml
special: adapter: mysql2 host: localhost username: database: special_db encoding: latin1
3. The rake task is to work in a special environment, and the code in the rake team deals only with a special one .
To achieve this, I know that I need to define some configurations, but I'm not sure:
What / How exactly you need to configure to create an environment
(As you saw above, I defined only a special database in the database.yml file, but where and how to define and configure for the new enverionment?)
How to run rake task code in a special environment and work only with a special database in Rails. Can someone please
PS
I need to run everything in a grabbed task not from the command line. How to change the environment and how to check the changes?
-------------- A reason was found, but not sure if the solution is ---------------------
Well, I found the cause of this wired problem due to the mysql2 stone, which seems to be unable to load the new special environment, if I switch to using mysql gem, the problem will disappear. But this method should use mysql2 for some other reason. How to get rid of this mysql2 problem?
source share