开发者

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'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜