Can I add my own application environment?

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

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

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

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?

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs