rails/rails — Issue #3417: Should RailsHelper really overwrite stylesheet_path/javascript_path?
Author: rasmusrn
Created: 2011-10-24 09:00:52+00:00
State: open

In my 3.1.1 app `stylesheet_path('application')` throws `ActionView::Template::Error (application isn't precompiled)`. `stylesheet_include_tag` works fine, but in this case I need the path for the stylesheet.

I think this happens because `Sprockets::Helpers::RailsHelper.stylesheet_path` only calls `asset_path(source)` without specifying file extensions, asset type or anything.

`stylesheet_tag_helpers.rb` seem to be doing it the proper way:

def stylesheet_path(source)
asset_paths.compute_public_path(source, 'stylesheets', :ext => 'css', :protocol => :request)
end

This method is included in Sprockets::Helpers::RailsHelper (through ActionView::Helpers::AssetTagHelper), but overridden afterwards with

`
def stylesheet_path(source)
asset_path(source)
end
`

If I remove the stylesheet_path method from RailsHelper, everything works as expected.

With my level of understanding of Rails and Sprockets, it would seem that both javascript_path and stylesheet_path should be removed from RailsHelper as they are given through AssetTagHelper.

I'd be glad if anyone with a greater insight would comment on this. Thank you!