DreamhostでRailsアプリをdevelopmentモードで動かす

いつからかわかりませんが、DreamhostでRailsアプリを立ち上げると、常にproductionモードで立ち上がるようになってしまいました。

開発はWEBrickで、運用はFastCGIで、な状態なので、正直、productionモードだけだと不便でなりません。
ので、何とかならんものかと探してみてたら、あったよ。ってことで、メモ。


答えは、ここに。

Switching Between Environments

Rails can be used in different enivronments. Each environment will change the behaviour of your application in small ways, and can be used to help you with each stage of the development cycle. The three environments are:

1. Development - (not support on dreamhost) In development, you are generally changing the code rapidly and reloading your application. You don’t need to restart the server or the application to see your changes. Rails error messages will be technically descriptive.

2. Test

3. Production - In production, your code is expected not to change, so models and controllers are cached to run faster. That means no repeated trips to the database to ask about columns and types, resulting in a quicker loading application. Rails error messages are very concise and non technical.

The following instructions are for Dreamhost Rails applications on Apache servers (by default they are), with FastCGI support selected. FastCGI is not supported out of the box so if you suspect your application to not be using FastCGI then see the Configuring Your Application section above.

Open the file environment.rb in the config directory and replace the line:

RAILS_ENV = ENV['RAILS_ENV'] || 'production'

with

RAILS_ENV = 'development'

You can replace development with production in the line above to switch back to that environment again.

すごく端折ると、config/environment.rbで

RUBY:
  1. RAILS_ENV = ENV['RAILS_ENV'] || 'development'

ではなく、

RUBY:
  1. RAILS_ENV = 'development'

こう書けということらしい。

ちなみに、これでやってみたら、ものすごいあっさりDBの向き先とかが変わって、ちっっっっ(怒)と舌打ちしたのは言うまでもなかったり。
なんだかものっそい腹立つ。

Via:

このエントリをはてなブックマークに追加このエントリをdel.icio.usに追加 |

0 Responses to “DreamhostでRailsアプリをdevelopmentモードで動かす”


  1. No Comments

Leave a Reply