# How to switch to "Production" mode?

**URL:** <https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149>\
**Category:** Rails\
**Created:** [January 6, 2008, 9:14am UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149 "2008-01-06T09:14:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 6, 2008, 9:14am UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/1 "2008-01-06T09:14:42Z")

</div>

Hi guys,

This is probably very easy question to answer but is perplexing a  
newbie ROR guy like me…

I have successfully set up a Netbeans, MySQL server and gotten my  
first RailsApplication1 set up. On my [http://localhost:3000](http://localhost:3000) page, I  
can see that all is set up and well. Clicking on “About your  
application’s environment” shows me a nice ajax view that says:

Ruby version 1.8.6 (i386-mswin32)  
RubyGems version 0.9.4  
Rails version 2.0.2  
Active Record version 2.0.2  
Action Pack version 2.0.2  
Active Resource version 2.0.2  
Action Mailer version 2.0.2  
Active Support version 2.0.2  
Application root C:/work/Prj\_ROR/RailsApplication1  
Environment development  
Database adapter mysql

My question is - and I have been scratching my head over the past half  
hour fiddling with various files including the environment.rb file -  
and I still have no clue HOW to run my local Ruby On Rails App in  
PRODUCTION mode instead of DEVELOPMENT mode as it is right now…

Surely, there must be a simple way to do this?

Anyone?

Sorry for this really dumb question.

Ellils

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 6, 2008, 9:26am UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/2 "2008-01-06T09:26:58Z")

</div>

Hi Ellis,

are you starting your server with ‘ruby script/server’ ?

If so, you can switch to production mode with:  
ruby script/server -e production

To get the full help, either type :  
ruby script/server --help

You’ll find more explanations here: [http://api.rubyonrails.org/](http://api.rubyonrails.org/)

hope this help

## Thibaut

LoGeek  
[blog] [http://evolvingworker.com](http://evolvingworker.com) - tools for a better day  
[blog] [http://blog.logeek.fr](http://blog.logeek.fr) - about writing software

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 6, 2008, 2:49pm UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/3 "2008-01-06T14:49:38Z")

</div>

Hi!

Thanks. This seems to work. I am getting a different “environment”  
message now. Instead of saying the whole chunk as mentioned above, it  
now says:  
"  
Routing Error  
No route matches “/rails/info/properties” with {:method=\>:get}  
"

which probably means I have to configure my Route I suppose? Not sure  
if this is the correct interpretation of what is happening here…

Another question would be more pertaining to Netbeans. Thibaut’s  
method seems to be applicable only if I run ruby script/server -e  
production in command line. I was wondering how to force the  
application to be working in production mode while inside Netbeans  
IDE. I was hoping to do everything within Netbeans IDE and not to  
have to worry about command line at all.

Regards,  
Ellils

On Jan 6, 4:26 pm, “Thibaut Barrère” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 6, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/4 "2008-01-06T23:15:01Z")

</div>

Hi Brian,

Okay, sounds simple enough 🙂

So whenever I want to view my production mode site, I just have to  
jump over to DOS and run webrick in production mode.

Regards,  
Ellils

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 7, 2008, 2:12am UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/5 "2008-01-07T02:12:10Z")

</div>

On Jan 7, 2008 8:44 AM, ellils [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi Brian,
> 
> Okay, sounds simple enough 🙂
> 
> So whenever I want to view my production mode site, I just have to  
> jump over to DOS and run webrick in production mode.

## No, you should be able to view your “production site” in development mode. This way you don’t have to keep restarting your server when you change controllers and models.

Ryan B.  
[http://www.frozenplague.net](http://www.frozenplague.net)  
Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 6, 2008, 6:36pm UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/6 "2008-01-06T18:36:57Z")

</div>

I’m going to really simplify this for you:

Don’t. There’s no good reason I can think of to run Rails in production  
mode via Netbeans. Of course, you may have one, but let’s see if we can  
get  
around it.

Production mode is for production. Models and controllers are cached,  
and  
other things work differently but none of those should change how your  
application behaves code-wise. If you’re trying to get things like page  
caching and other things to work in development mode, simply see the  
environments/ folder in the config folder. You can change how each  
environment works. If you’ve got code that checks for different  
environment  
modes and does different things, you should have tests to check that  
functionality.

Let us know if you still need help 🙂

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 7, 2008, 5:19pm UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/7 "2008-01-07T17:19:40Z")

</div>

If you still want to use production mode from within NetBeans, this is  
described in the following post:  
[http://www.nabble.com/Re%3A-Changing-Mongrel-parameters--p14659714.html](http://www.nabble.com/Re%3A-Changing-Mongrel-parameters--p14659714.html)

– Tor

---

<div class="post-metadata">

**Author:** ![ellils](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ba9def/32.png) [@ellils](https://www.ruby-forum.com/u/ellils)\
**Post date:** [January 9, 2008, 8:46am UTC](https://www.ruby-forum.com/t/how-to-switch-to-production-mode/125149/8 "2008-01-09T08:46:18Z")

</div>

uncomment in your environment.rb

# Uncomment below to force Rails into production mode when

# you don’t control web/app server and can’t set it the proper way

# ENV[‘RAILS\_ENV’] ||= ‘production’
