aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/sprockets/helpers
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2011-08-21 16:42:06 -0500
committerJoshua Peek <josh@joshpeek.com>2011-08-21 16:42:06 -0500
commit63d3809e31cc9c0ed3b2e30617310407ae614fd4 (patch)
tree77cf65556f78e1cbcd6b815f1f2d426f3f2dd455 /actionpack/lib/sprockets/helpers
parentf25d65d2fbe2a0e65affdb87c2a27f47dbe80a09 (diff)
downloadrails-63d3809e31cc9c0ed3b2e30617310407ae614fd4.tar.gz
rails-63d3809e31cc9c0ed3b2e30617310407ae614fd4.tar.bz2
rails-63d3809e31cc9c0ed3b2e30617310407ae614fd4.zip
Fix sprockets warnings
Fixes #2598
Diffstat (limited to 'actionpack/lib/sprockets/helpers')
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index a65c5992ca..69306ef631 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -112,11 +112,22 @@ module Sprockets
asset_environment[source]
end
+ def digest_for(logical_path)
+ if asset = asset_environment[logical_path]
+ return asset.digest_path
+ end
+
+ logical_path
+ end
+
def rewrite_asset_path(source, dir)
if source[0] == ?/
source
else
- asset_environment.path(source, performing_caching?, dir)
+ source = digest_for(source) if performing_caching?
+ source = File.join(dir, source)
+ source = "/#{url}" unless source =~ /^\//
+ source
end
end