3.1.1.rc2: "wrong number of arguments (3 for 2)" in stylesheet_link_tag #3218

Closed
eostrom opened this Issue Oct 4, 2011 · 3 comments

3 participants

@eostrom

I don't have a minimal test case for this yet, but the line in my Haml view is:

    = stylesheet_link_tag :flutie, 'application', :media => 'all', :cache => true

and the stack trace from there down is:

wrong number of arguments (3 for 2) (ActionView::Template::Error)
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/sprockets/helpers/rails_helper.rb:125:in `compute_source_path'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb:68:in `path_to_asset_source'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb:99:in `block in ensure_sources!'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb:98:in `each'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb:98:in `ensure_sources!'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb:56:in `include_tag'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb:138:in `stylesheet_link_tag'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/sprockets/helpers/rails_helper.rb:52:in `block in stylesheet_link_tag'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/sprockets/helpers/rails_helper.rb:46:in `collect'
/Users/eostrom/.rvm/gems/ruby-1.9.2-p290@pooch/gems/actionpack-3.1.1.rc2/lib/sprockets/helpers/rails_helper.rb:46:in `stylesheet_link_tag'
./app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml___2828769444619181198_2200300820'

ActionView::Helpers::AssetTagHelper::AssetIncludeTag#path_to_asset_source has this line:

            asset_paths.compute_public_path(source, asset_name.to_s.pluralize, options.merge(:ext => extension))

and Sprockets::Helpers::RailsHelper::AssetPaths#compute_source_path is defined as such:

        def compute_source_path(source, ext)
@spastorino
Ruby on Rails member

You shouldn't be using :cache => true with the asset pipelining. But anyway I can see that is confusing because we don't have docs for sprockets/helpers/rails_helper.rb which is overriding the helpers for non asset pipelining users.

I'm going to close the issue but we still have to document this file.

@spastorino spastorino closed this Oct 4, 2011
@eostrom

(Deleted my previous, misinformed comment; please disregard.)

@mspanc

I encounter the same under RoR 3.1.2.

There's no info in the docs that caching is not compatible with assets pipelining. Maybe it would be worth adding?

The error thrown by rails could also be more descriptive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment