# Use production environment in other environments

**URL:** <https://www.ruby-forum.com/t/use-production-environment-in-other-environments/141248>\
**Category:** Rails\
**Created:** [June 24, 2008, 1:47am UTC](https://www.ruby-forum.com/t/use-production-environment-in-other-environments/141248 "2008-06-24T01:47:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr\_tibs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@mr\_tibs](https://www.ruby-forum.com/u/mr_tibs)\
**Post date:** [June 24, 2008, 1:47am UTC](https://www.ruby-forum.com/t/use-production-environment-in-other-environments/141248/1 "2008-06-24T01:47:34Z")

</div>

Hi,

I created a new staging environment for my Rails application called  
“staging”. I would like to use the production database while in the  
staging mode. I’m pretty sure I need to modify environments/staging.rb  
(which I cloned from environments/production.rb), but I don’t know  
which variable to set to the production database and how.

Thanks,  
Tiberiu

---

<div class="post-metadata">

**Author:** ![mr\_tibs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@mr\_tibs](https://www.ruby-forum.com/u/mr_tibs)\
**Post date:** [June 24, 2008, 1:48am UTC](https://www.ruby-forum.com/t/use-production-environment-in-other-environments/141248/2 "2008-06-24T01:48:44Z")

</div>

The title should be “use production database in other environments”

---

<div class="post-metadata">

**Author:** ![mr\_tibs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@mr\_tibs](https://www.ruby-forum.com/u/mr_tibs)\
**Post date:** [June 24, 2008, 1:57am UTC](https://www.ruby-forum.com/t/use-production-environment-in-other-environments/141248/3 "2008-06-24T01:57:31Z")

</div>

If you’ve already set up the configured environment can’t just add a  
staging section to your database.yml that points to the production db?  
Have you checked out [#72 Adding an Environment - RailsCasts](http://railscasts.com/episodes/72)

Best.  
Mike

---

<div class="post-metadata">

**Author:** ![mr\_tibs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@mr\_tibs](https://www.ruby-forum.com/u/mr_tibs)\
**Post date:** [June 24, 2008, 2:38am UTC](https://www.ruby-forum.com/t/use-production-environment-in-other-environments/141248/4 "2008-06-24T02:38:28Z")

</div>

Hi Mike,

That’s what I ended up doing - I just thought there is a more Railish  
way to do it. And thanks for the railscast episode.

Thanks,  
Tiberiu
