how can I run Rack::Static only if it starting in production env?
I have a config.ru for Rails 3.0.5 app like this :开发者_Go百科
require ::File.expand_path('../config/environment', __FILE__)
use Rack::Static, :urls => ['/uploads'], :root => 'tmp'
run newapp::Application
but I want to exec the use Rack::Static, :urls => ['/uploads'], :root => 'tmp'
line if and only if Rails start in production.
How can I do it ? Thanks in advance luca
Instead of doing this in your config.ru you can do it in your environment, so in production.rb
add this:
config.middleware.use Rack::Static, :urls => ['/uploads'], :root => 'tmp'
精彩评论