Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

asset helpers don't work inside html in asset pipeline #5411

Closed
koenhandekyn opened this Issue · 3 comments

3 participants

@koenhandekyn

when using for example

<%= javascript_include_tag "application" %>

inside a .html.erb file inside the asset pipeline, this works fine at runtime but not during pre compilation due to unavailability of the "params" variable in the below method when doing asset precompilation.

  private
  def debug_assets?
    compile_assets? && (Rails.application.config.assets.debug || params[:debug_assets])
  rescue NoMethodError
    false
  end

ideally the check on the params is only performed when they are actually available (runtime configuration).

there is a fix, add this to your production.rb

module Sprockets 
module Helpers
  module RailsHelper

    private
    def debug_assets?
      false
    end

  end
end

end

@vjpr

I had this exact same issue. Changing params[:debug_assets] to params?[:debug_assets] would fix it.

@vjpr vjpr referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@kennyj kennyj referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@kennyj
Collaborator

I think that I fixed this issue and sent PR to 3-2-stable :-)
#5525

and please see also #5429.

@kennyj
Collaborator

I'm closing this issue, because the above PR is merged. thanks

@kennyj kennyj closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.