Permalink
Browse files

ASSETS_PREFIX should always be prefixed by /

  • Loading branch information...
1 parent e8f444e commit e5113eb37c6855e7cb96ecaada7934c2bf85b6b6 @thenoseman thenoseman committed with route Apr 18, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/quiet_assets.rb
View
@@ -8,15 +8,15 @@ class Engine < ::Rails::Engine
initializer "quiet_assets", :after => "sprockets.environment" do |app|
if app.config.quiet_assets == true
# Parse PATH_INFO by assets prefix
- ASSETS_PREFIX = app.config.assets.prefix.split("/").join("/") + "/"
+ ASSETS_PREFIX = "/#{app.config.assets.prefix[/\A\/?(.*?)\/?\z/, 1]}/"
app.config.assets.logger = false
# Just create an alias for call in middleware
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
old_logger_level, level = Rails.logger.level, Logger::ERROR
# Increase log level because of messages that have a low level should not be displayed
- Rails.logger.level = level if env['PATH_INFO'].index(ASSETS_PREFIX) == 0
+ Rails.logger.level = level if env['PATH_INFO'].start_with?(ASSETS_PREFIX)
call_without_quiet_assets(env)
ensure
# Return back

0 comments on commit e5113eb

Please sign in to comment.