Skip to content
This repository
Browse code

image_tag should use /assets if asset pipelining is turned on. Closes #…

  • Loading branch information...
commit 0cb84f18d646dda6e46bab86a2c817ded0da0d10 1 parent 6c5295f
Santiago Pastorino authored September 26, 2011
4  actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -60,6 +60,10 @@ def asset_path(source, options = {})
60 60
         options[:body] ? "#{path}?body=1" : path
61 61
       end
62 62
 
  63
+      def path_to_image(source)
  64
+        asset_paths.compute_public_path(source, asset_prefix)
  65
+      end
  66
+
63 67
     private
64 68
       def debug_assets?
65 69
         begin
4  actionpack/test/template/sprockets_helper_test.rb
@@ -125,6 +125,10 @@ def url_for(*args)
125 125
     end
126 126
   end
127 127
 
  128
+  test "image_tag" do
  129
+    assert_dom_equal '<img alt="Xml" src="/assets/xml.png" />', image_tag("xml.png")
  130
+  end
  131
+
128 132
   test "stylesheets served without a controller in do not use asset hosts when the default protocol is :request" do
129 133
     remove_instance_variable("@controller")
130 134
     @config.action_controller.asset_host = "assets-%d.example.com"

1 note on commit 0cb84f1

Christos Zisopoulos

This commit breaks the image_path helper when the asset pipeline is enabled.

See pull request #3138

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