Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

4 participants

@wagenet

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.

@wagenet

sprockets-rails version here: rails/sprockets-rails#20

@wagenet wagenet referenced this pull request in rails/sprockets-rails
Merged

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

@wagenet

@drogus, whoops. Fixed.

@drogus
Collaborator

@wagenet no problem, I've added CHANGELOG to guides only recently and we haven't really asked for entries most of the time before that

@rafaelfranca

@wagenet this will need a rebase since it have some commits that should be have.

@wagenet wagenet 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.
1ac19c1
@wagenet

@rafaelfranca Done. Are you guys force pushing to 3-2-stable?

@guilleiguaran

@wagenet the force push was done by mistake by a committer, sorry for the problem

@wagenet

No worries. Happens to the best of us.

@rafaelfranca rafaelfranca merged commit 7c5454e into rails:3-2-stable
@rafaelfranca

Thanks. And sorry for the mess.

@rafaelfranca

@wagenet the build is broken could you take a look?

cc/ @guilleiguaran

@rafaelfranca rafaelfranca referenced this pull request from a commit
@rafaelfranca rafaelfranca Revert "Respect `config.digest = false` for `asset_path`"
This reverts commit 1ac19c1.

Conflicts:
	actionpack/CHANGELOG.md

Reason: This is causing failures in the railties build.
See http://travis-ci.org/#!/rails/rails/jobs/2491787

Related with #7672
54f5574
@rafaelfranca

Guys I reverted the commits since we don't have any solution in two days. If you want to add it back please revert 54f5574 and make the tests pass locally.

@wagenet

@rafaelfranca It looks like the railties tests are expecting a failure that my changes no longer cause to happen. I'm happy to fix it, but I don't really have any direction on what the fix should be.

@wagenet

Basically, I can just remove that test, assuming that it shouldn't be expecting a failure. I honestly don't know why there is a test for the exception there, when the code is in actionpack.

@rafaelfranca

@wagenet I think I fixed it with help of @guilleiguaran. I will push soon.

Thank you.

@wagenet

@rafaelfranca Cool. If there's anything you need from me, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 17, 2012
  1. @wagenet

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

    wagenet authored
    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.
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.