Permalink
Browse files

Preserve stylesheet_link_tag and javascript_include_tag options on debug

  • Loading branch information...
1 parent e0db9cb commit 23b5c5522160928005b0aa949b3f9a894e2618aa @guilleiguaran guilleiguaran committed Aug 24, 2011
Showing with 3 additions and 4 deletions.
  1. +3 −4 actionpack/lib/sprockets/helpers/rails_helper.rb
View
7 actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -26,7 +26,7 @@ def javascript_include_tag(*sources)
sources.collect do |source|
if debug && asset = asset_paths.asset_for(source, 'js')
asset.to_a.map { |dep|
- javascript_include_tag(dep, :debug => false, :body => true)
+ javascript_include_tag(dep, options.stringify_keys.merge!({ :debug => false, :body => true }))
@tenderlove
tenderlove Aug 25, 2011

Should :debug and :body be strings too? I don't like that we're mixing string and symbol keys in this hash.

@guilleiguaran
guilleiguaran Aug 25, 2011

ok, I will change it and send a pull request

@tenderlove
tenderlove Aug 25, 2011

Sounds good! Thank you!

@spastorino
spastorino Aug 25, 2011

Ouch yup that's wrong. My bad since I was helping Guillermo ;).

@guilleiguaran
guilleiguaran Aug 25, 2011

@spastorino, go catch, we can remove it without side effects!!!

}
else
super(source.to_s, { 'src' => asset_path(source, 'js', body) }.merge!(options.stringify_keys))
@@ -38,15 +38,14 @@ def stylesheet_link_tag(*sources)
options = sources.extract_options!
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
- media = options.key?(:media) ? options.delete(:media) : "screen"
sources.collect do |source|
if debug && asset = asset_paths.asset_for(source, 'css')
asset.to_a.map { |dep|
- stylesheet_link_tag(dep, :media => media, :debug => false, :body => true)
+ stylesheet_link_tag(dep, options.stringify_keys.merge!({ :debug => false, :body => true }))
}
else
- super(source.to_s, { 'href' => asset_path(source, 'css', body, :request), 'media' => media }.merge!(options.stringify_keys))
+ super(source.to_s, { 'href' => asset_path(source, 'css', body, :request) }.merge!(options.stringify_keys))
end
end.join("\n").html_safe
end

0 comments on commit 23b5c55

Please sign in to comment.