Skip to content

Better HTML breaks Rails error page when web-console gem is used #50

@jonniesweb

Description

@jonniesweb

Hey folks 👋

When @clayton-shopify hooked us up with better_html in https://github.com/Shopify/help/pull/7582, it introduced a bug that was fixed in https://github.com/Shopify/help/pull/7839.

What ended up happening was that when the config.allow_single_quoted_attributes = false is set and the web-console gem is installed, anytime an error occurs when developing locally causes the Rails error page to fail to render. https://github.com/Shopify/help/pull/7839 has a bit more of a description of this problem.

The one solution I discovered from the better-html README was to exclude running better-html on any of the ERB templates from the app's gems via:

BetterHtml.configure do |config|
  config.allow_single_quoted_attributes = false
  config.template_exclusion_filter = Proc.new { |filename| !filename.start_with?(Rails.root.to_s) }
end

I wasn't able to figure out a way to exclude only the web-console gem's ERB templates. The following method didn't work:

BetterHtml.configure do |config|
  config.allow_single_quoted_attributes = false
  config.template_exclusion_filter = proc do |filename|
    filename.include?('web_console')
  end
end

Let me know if there's any extra info I can provide 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions