I have just started learning ROR and came across this DOUBT.
I have defined several databases in my database.yml file like this:
development: adapter: mysql2 encoding: utf8 reconnect: correct databases: Mydb1 username: root password: root host: local host custom: adapter: mysql2 encoding: utf 8 reconnect: true database: custom deb usernames: root password: root host: localhost
now If I prepare a model using the rail model, model MyModel
As it is, it will generate a migration to create a table - my_models
in mydb1
.
Do I need to change my rail environment or someone else? My question is "How do I create / specify a model to create a table under the custom model?"
Way? I'm just curious. I can do this manually by creating a table in customdb
and creating a model without migration.
You will need to specify the environment in the Rail G command, then it will automatically convert into custom database database
RAILS_ENV = Custom Rail model generates MyModel
No comments:
Post a Comment