Rails :How to change the environment of rails OR simply running project on required environment without changing environment setting in bash* ?

Their are 3 Rails Environments development, production, development. You can change between them by writing the following code inside your ~/.basrc   or  ~/.bash_profile

write:

export RAILS_ENV="production"    or
export RAILS_ENV="development"    or 
export RAILS_ENV="test"

for the respected environment. Or if you don’t want to change the environment just simply want to run the project on the respected environment then you can use this:

$rails db:migrate RAILS_ENV=production
$rails server -e production

or

$rails db:migrate RAILS_ENV=development
$rails server -e development

or

$rails db:migrate RAILS_ENV=test
$rails server -e test
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: