djibouti33
djibouti33

Reputation: 12132

Rails app + caching and environment modes

I just finished setting up a Rackspace Cloud Server to host a website I'm going to build using Ruby on Rails. I've installed the latest versions of Apache, Rails, and Passenger (although to be honest, I'm not quite sure what Passenger gets me) - (I just checked, and Passenger doesn't come up in a gem list, but it is present in mods-enabled).

I've got everything set up, and I can get simple routes working with the appropriate controllers and views.

The problem I'm having is that it I can only see changes to a view after restarting Apache, so I assume some sort of caching is going on. I've followed several tips on SO for how to make sure I'm running in development mode, but nothing seems to work. I've placed a statement in my Apache config file, as well as in my Rails app's environment.rb file.

1) How can I see which mode I'm currently in? 2) How do I change it to whatever I need it to be?

Also, a lot of answers I'm finding are presuming that you're running your app in script/console mode. I'm working directly on the server via ssh, and I haven't ever had to turn my rails app on using script/console. It's just there and running.

Thanks

Update: If I print out Rails.env in a view, it lists production. If I fire up rails console on the command line, and print out Rails.env, it lists development.

Upvotes: 0

Views: 100

Answers (1)

sosborn
sosborn

Reputation: 14694

Without seeing how you set the environment, this is the best advice I can give you.

<VirtualHost *>
  ServerName example.com
  DocumentRoot /home/yourname/htdocs/example.com/public
  RailsEnv development
  //Plus whatever else you might have in your standard Virtual Host
</VirtualHost>

After you edit this file you must restart Apache.

Upvotes: 1

Related Questions