Basic Information
I have a rails app A that is connected to a mysql database hosted on dotcloud.com. Below is how my database.yml file looks like,
production:
adapter: mysql2
host: <host>
port: <port>
database: <database_name>
username: <username>
password: <password>
Until here it works fine, I can access the records in the database from A, do queries and stuff.
Now I have another rails app B that needs to be connected to the same database as A, so i simply copy and paste the exact same details above into the database.yml file in B. However, when I tried to go into the rails console on production, I can't seem to access the database. For example if I had a User Table, it will just say NameError: uninitialized constant User
.
Is this an access control issue? How should I go about debugging this problem?
Appreciate any advice.
Update
So I copy and paste the .rb and schema files from A to B. However I am getting uninitialized constant ActiveRecord (NameError)
when trying to access the database in rails console. Anyone know how to ?
I ended up creating a new rails app, and setup everything again. Copy the same database.yml config then did rake db:migrate, then include the necessary model files, went into rails console and it works now.
:)