Skip to content
Browse files

Respect `config.digest = false` for `asset_path`

Previously, the `asset_path` internals only respected the `:digest`
option, but ignored the global config setting. This meant that
`config.digest = false` could not be used in conjunction with
`config.compile = false` this corrects the behavior.
  • Loading branch information...
1 parent 24a7774 commit 1ac19c11792a745cd654f02dfaed8e93f95b3c70 @wagenet committed
View
9 actionpack/CHANGELOG.md
@@ -1,5 +1,14 @@
## Rails 3.2.9 (unreleased) ##
+* Respect `config.digest = false` for `asset_path`
+
+ Previously, the `asset_path` internals only respected the `:digest`
+ option, but ignored the global config setting. This meant that
+ `config.digest = false` could not be used in conjunction with
+ `config.compile = false` this corrects the behavior.
+
+ *Peter Wagenet*
+
* Fix #7646, the log now displays the correct status code when an exception is raised.
*Yves Senn*
View
4 actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -147,7 +147,9 @@ def rewrite_asset_path(source, dir, options = {})
if source[0] == ?/
source
else
- source = digest_for(source) unless options[:digest] == false
+ if digest_assets && options[:digest] != false
+ source = digest_for(source)
+ end
source = File.join(dir, source)
source = "/#{source}" unless source =~ /^\//
source
View
8 actionpack/test/template/sprockets_helper_test.rb
@@ -360,4 +360,12 @@ def compute_host(source, request, options = {})
assert_equal '/assets/logo.png',
asset_path("logo.png")
end
+
+ test "`config.digest = false` works with `config.compile = false`" do
+ @config.assets.digest = false
+ @config.assets.compile = false
+
+ assert_equal '/assets/logo.png',
+ asset_path("logo.png")
+ end
end

0 comments on commit 1ac19c1

Please sign in to comment.
Something went wrong with that request. Please try again.