2013-03-06 94 views
0
Started GET "/assets/reset.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011 
Served asset /reset.css - 304 Not Modified (1ms) 


Started GET "/assets/style.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011 
Served asset /style.css - 304 Not Modified (0ms) 


Started GET "/assets/application.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011 
Started asset /application.css - 304 Not Modified (0ms) 


Started GET "/assets/application.js?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011 
Served asset /application.js - 200 OK (1ms) 

我想避免這個消息,如果我關掉調試模式,如何避免在開發模式下資產的消息

config.assets.debug = off 

資產的文件將作爲連接在一起。

無論如何擺脫這條消息以及資產應該服務於單獨的資產文件。

回答

0

配置/初始化/ quite_assets.rb

if Rails.env.development? 
    Rails.application.assets.logger = Logger.new('/dev/null') 
    Rails::Rack::Logger.class_eval do 
     def call_with_quiet_assets(env) 
     previous_level = Rails.logger.level 
     Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/} 
     call_without_quiet_assets(env) 
     ensure 
     Rails.logger.level = previous_level 
     end 
    alias_method_chain :call, :quiet_assets 
    end 
end 
1

在您的Gemfile使用gem 'quiet_assets'

group :development do 
    gem 'sqlite3' 
    gem 'quiet_assets' 
end 
相關問題