# Can I add my own application environment?

**URL:** <https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071>\
**Category:** Rails\
**Created:** [September 7, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071 "2007-09-07T16:02:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![helzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@helzer](https://www.ruby-forum.com/u/helzer)\
**Post date:** [September 7, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071/1 "2007-09-07T16:02:56Z")

</div>

I’d like to set up a fourth environment for the application to run in.  
Something which will behave exactly as ‘production’, but will have its  
own database and where I can load up a special config/mymode.rb file,  
that will set up special constants.

The idea is to implement something like Paypal’s sandbox. An  
environment running just like the normal production application, but  
where anything goes and nothing costs.

- test
- development
- production
- sandbox

Is this at all possible?

Thanks,  
Helzer

---

<div class="post-metadata">

**Author:** ![helzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@helzer](https://www.ruby-forum.com/u/helzer)\
**Post date:** [September 7, 2007, 4:43pm UTC](https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071/2 "2007-09-07T16:43:02Z")

</div>

It certainly is. Basically you just need to add it to your  
database.yml. You can also add in the sandbox.rb environment config  
file (for instance by making a copy of production.rb)

Rein

---

<div class="post-metadata">

**Author:** ![helzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@helzer](https://www.ruby-forum.com/u/helzer)\
**Post date:** [September 7, 2007, 4:47pm UTC](https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071/3 "2007-09-07T16:47:03Z")

</div>

Thanks Rein,

I didn’t realize it’s that simple. Now that I look at it, I see that  
what makes the development application behave that way is the  
config.cache\_classes=false setting.

Much appreciated,  
Helzer

---

<div class="post-metadata">

**Author:** ![helzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@helzer](https://www.ruby-forum.com/u/helzer)\
**Post date:** [September 8, 2007, 10:53am UTC](https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071/4 "2007-09-08T10:53:37Z")

</div>

So say I created a new enviroment called ‘staging’ by creating  
staging.rb in the environments directory and added a staging section  
to my database.rb.

Staging would be just like production, however, a test version of  
it… one step before production. It’s on the remote server and  
everything.

I’m kind of confused on how to deploy my app with capistrano now…  
Can I set the environment using capistrano or does it always just  
assume it’s production?

---

<div class="post-metadata">

**Author:** ![helzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@helzer](https://www.ruby-forum.com/u/helzer)\
**Post date:** [September 8, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/can-i-add-my-own-application-environment/114071/5 "2007-09-08T15:19:04Z")

</div>

I’ve had to slightly edit the Capistrano deploy scripts anyway. What I’m  
planning to do is edit them a bit more so that I have a ‘sandbox’ deploy  
and  
a production deploy. All you need to do really is copy and edit the  
restart  
function to include the name of the environment you want to restart.

Helzer
