#72
Sep 24, 2007

Adding an Environment

Rails comes with three environments: development, test, and production. But, you aren't restricted to just these. You can add your own! See how in this episode.
Download (7.1 MB, 3:22)
alternative download for iPod & Apple TV (4.9 MB, 3:22)
# database.yml
staging:
  adapter: mysql
  database: store_staging
  user: root
  password:
  host: localhost
# environments/staging.rb
config.log_level = :debug
mysqladmin create store_staging -u root -p
rake db:migrate RAILS_ENV=staging
script/server -e staging

RSS Feed for Episode Comments 10 comments

1. seb Sep 24, 2007 at 01:16

Great cast!
It would be great to see how to setup capistrano to use staging environment may be the next screencasts :)


2. Rich Cavanaugh Sep 24, 2007 at 06:38

I don't know about Capistrano but, I do have a solution for staging environments using Vlad on my blog.


3. Chris Barnes Oct 23, 2007 at 22:11

I've been using a custom environment for beta testing and it works really well. I can have beta testers using an edge version of my code while the production users data is unaffected. I can also give beta testers more info in their error messages.


4. Matt Nov 02, 2007 at 11:09

Thanks for the tip.

One thing that made me curious enough to dig thru the initializer code was the bit on having to set the config.log_level = :debug. This isn't necessary. The initializer only sets the log level to :info if the environment == 'production'. Otherwise, all other environments are set to :debug


5. Anthony Ettinger Nov 13, 2008 at 15:45

Look at the multistage plugin for capistrano, it will work nicely with additional environments.


6. Ash McKenzie Jan 18, 2009 at 16:19

Just found that you cannot use the underscore character (and possibly others) in the environment name.

I was after development_home, but had to settle for developmenthome.


7. ginger Sep 12, 2009 at 06:10

www.luxurykick.com wholesale and export latest and best brand name sports shoes such as nike air Jordan flight 45, 2009 Jordan foamposite lite, Air Jordan Schoolin’ Ray Allen, Jordan Jump man Pro, Jordan CP3 shoes, Jordan Melo M5, Jordan Trunner Q4 shoes, Jordan True Flight, Jordan M5 and Q4 mix, Jordan 09 Memory Version, Nike Michael Jackson etc. We also sell high quality replica handbags, jeans, jewelry, Gucci belts, Louis Vuitton belts, Ed hardy belts, Gucci caps, Louis Vuitton caps, Fendi caps etc. You can just contact us luxurykick at gmail dot com or add our msn luxurykick at hotmail dot com for details. Tks!
Looking forward to a mutually beneficial business relationship with you!
Website: www.luxurykick.com
MSN: luxurykick@hotmail.com
Gmail: luxurykick@gmail.com
Email: luxurykick@yahoo.com
 


8. gol Oct 22, 2009 at 05:38

antikrizisnoe-upravlenie.ru/


9. ramiro Jan 20, 2010 at 22:25

Thank you for sharing.Nice post.


10. cheap adidas shoes Jan 31, 2010 at 19:12

Adidas Shoes Online Shop-Hot Selling Adidas Shoes & Cheap Adidas Shoes

Add your comment:

(SKIP THIS ONE)

(required)

(not shown)


(use pastie or gist for code)

sponsored by:
if you want to help:
required:
Get Quicktime Player
Give Back to Open Source