aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/sprockets/helpers
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2011-08-31 12:47:33 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2011-08-31 13:12:09 -0500
commitf236e00189b5a6cf0cebac5c275f64d41d73428d (patch)
treeb698934e71ef9d329ccc14fef545239faf9f6362 /actionpack/lib/sprockets/helpers
parentfa04c37f45ca9299a5efb426913488b678c178ce (diff)
downloadrails-f236e00189b5a6cf0cebac5c275f64d41d73428d.tar.gz
rails-f236e00189b5a6cf0cebac5c275f64d41d73428d.tar.bz2
rails-f236e00189b5a6cf0cebac5c275f64d41d73428d.zip
Backport f443f9cb0c64 to master
Diffstat (limited to 'actionpack/lib/sprockets/helpers')
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb29
1 files changed, 9 insertions, 20 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 8e7eb182fd..975dc9e80c 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -61,7 +61,7 @@ module Sprockets
def debug_assets?
begin
config = Rails.application.config.assets
- config.allow_debugging && (config.debug || params[:debug_assets])
+ config.compile && (config.debug || params[:debug_assets])
rescue NoMethodError
false
end
@@ -114,22 +114,21 @@ module Sprockets
return digest
end
- if digest.nil? && Rails.application.config.assets.precompile_only
- raise AssetNotPrecompiledError
- end
-
- if asset = asset_environment[logical_path]
- return asset.digest_path
+ if Rails.application.config.assets.compile
+ if asset = asset_environment[logical_path]
+ return asset.digest_path
+ end
+ return logical_path
+ else
+ raise AssetNotPrecompiledError.new("#{logical_path} isn't precompiled")
end
-
- logical_path
end
def rewrite_asset_path(source, dir)
if source[0] == ?/
source
else
- source = digest_for(source) if performing_caching?
+ source = digest_for(source) if Rails.application.config.assets.digest
source = File.join(dir, source)
source = "/#{source}" unless source =~ /^\//
source
@@ -143,16 +142,6 @@ module Sprockets
source
end
end
-
- def performing_caching?
- # When included in Sprockets::Context, we need to ask the
- # top-level config as the controller is not available.
- if config.action_controller.present?
- config.action_controller.perform_caching
- else
- config.perform_caching
- end
- end
end
end
end