How to enable production enviornment in RoR 2.3.5

I want to enable production enviornment for my appication.The content of database.yml file is as

SQLite version 3.x

gem install sqlite3-ruby (not necessary on OS X Leopard)

development: adapter: mysql database: amritpal username: root password: 12345 pool: 5 timeout: 5000

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000

production: adapter: mysql database: production username: root password: 12345 pool: 5 timeout: 5000

I ran "RAILS_ENV=production rake db:create ",it created a production database.Here is assume that the production enviornment is enable(But i was wrong).Then i created a simple scaffold as.

script/generate scaffold person firstname:string lastname:string;

rake db:migrate(it created a table named"people" in amritpal database that is used in development envionrment.But in production enviornment ,the database production hasn’t any talbe)

How to enable it?

Thanks

How many times do I have to tell you? RAILS_ENV=production rake db:migrate will run the migrations on the production database.

If you do not understand or it does not work please say what you are having difficulty with.

Colin

I believe Colin already discussed with with you in another thread.

"As I have tried to explain several times the value of RAILS_ENV

determines which environment will be used when you execute a rake

command. The environment defaults to development. So:

rake db:migrate will migrate the development db.

RAILS_ENV=production rake db:migrate

will migrate the production db.

Colin "

If you are looking to be always running in production mode and never in any other mode then my advice would be the set the environment variable RAILS_ENV on your system to production.

RAILS_ENV=production

You can look up how to do that for your OS anywhere on the internet.

B.

At other thread ,i followed collin instrutions but at last i strucked a error to which i didnt receive a reply yet.So i post a new thread.Please look at that thread and see if you can help        http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/d911b888dbd30c58

Thanks

I want to enable production enviornment for my appication.The content of database.yml file is as

# SQLite version 3.x

# gem install sqlite3-ruby (not necessary on OS X Leopard) development:   adapter: mysql   database: amritpal   username: root   password: 12345   pool: 5   timeout: 5000

# Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test:   adapter: sqlite3   database: db/test.sqlite3   pool: 5   timeout: 5000

production:   adapter: mysql   database: production   username: root   password: 12345   pool: 5   timeout: 5000

                           I ran "RAILS_ENV=production rake db:create ",it created a production database.Here is assume that the production enviornment is enable(But i was wrong).Then i created a simple scaffold as.

                     script/generate scaffold person firstname:string lastname:string;

                     rake db:migrate(it created a table named"people" in amritpal database that is used in development envionrment.But in production enviornment ,the database production hasn't any talbe)

How to enable it?

Thanks

I believe Colin already discussed with with you in another thread.

"As I have tried to explain several times the value of RAILS_ENV determines which environment will be used when you execute a rake command. The environment defaults to development. So:

rake db:migrate will migrate the development db.

RAILS_ENV=production rake db:migrate will migrate the production db.

Colin "

If you are looking to be always running in production mode and never in any other mode then my advice would be the set the environment variable RAILS_ENV on your system to production.

RAILS_ENV=production

You can look up how to do that for your OS anywhere on the internet.

     At other thread ,i followed collin instrutions but at last i strucked a error to which i didnt receive a reply yet.So i post a new thread.Please look at that thread and see if you can help

Next time try looking at the second page of the thread - Colin replied yesterday. Even if he hadn't, proliferation of identical threads helps no-one.

Fred

> I want to enable production enviornment for my appication.The content of > database.yml file is as

> # SQLite version 3.x

> # gem install sqlite3-ruby (not necessary on OS X Leopard) > development: > adapter: mysql > database: amritpal > username: root > password: 12345 > pool: 5 > timeout: 5000

> # Warning: The database defined as "test" will be erased and > # re-generated from your development database when you run "rake". > # Do not set this db to the same as development or production. > test: > adapter: sqlite3 > database: db/test.sqlite3 > pool: 5 > timeout: 5000

> production: > adapter: mysql > database: production > username: root > password: 12345 > pool: 5 > timeout: 5000

> I ran "RAILS_ENV=production rake db:create ",it > created a production database.Here is assume that the production enviornment > is enable(But i was wrong).Then i created a simple scaffold as.

> script/generate scaffold person firstname:string > lastname:string;

> rake db:migrate(it created a table named"people" > in amritpal database that is used in development envionrment.But in > production enviornment ,the database production hasn't any talbe)

> How to enable it?

How many times do I have to tell you? RAILS_ENV=production rake db:migrate will run the migrations on the production database.

i ran " RAILS_ENV=production rake

db:create ",it created a production database.I hope now the prduction enviornment is enable

If you do not understand or it does not work please say what you are having difficulty with.

   Then i ran script/generate scaffold person firstname:string lastname:string;                    rake db:migrate(it created a table named"people" in production database .Then i put some entries into form and try to check table at back end(mysql) and did                               use production                               select * from people(it gave table is empty) why? but all entries went into amritpal database that is being used in deveoplement phase,why?

Thanks

Did you remember to start the server in production mode? How to do this was one of the very first questions you asked. In case you have lost the answer, use -e production when you start the server.

Colin

Thank you very much collin. Great!!!