ruby - Rails how to switch between dev and production mode? -


how can switch in rails between dev mode , production mode?

and how can deploy database production?

if using rails 4.2 must know rails uses "spring" make faster. in case can use following commands:

for development run

rails 4.2     bin\rails s otherwise    rails s 

for production run

rails 4.2     bin\rails s -e production otherwise         rails s -e production 

to setup production database if database in production not exist run

rails 4.2     bin/rake db:create db:migrate rails_env=production otherwise     rake db:create db:migrate rails_env=production     bundle exec rake db:create db:migrate rails_env=production 

if db exists the:

rails 4.2   bin/rake db:migrate rails_env=production otherwise   rake db:migrate rails_env=production   or   bundle exec rake db:migrate rails_env=production 

also if want stop spring or start spring use following commands:

 bin/spring stop  bin/spring start 

Comments