Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::Helpers::AssetTagHelper javascript/css link helpers break if the request object is nil #31265

Closed
tcannonfodder opened this issue Nov 28, 2017 · 3 comments

Comments

@tcannonfodder
Copy link
Contributor

Steps to reproduce

  1. Create a default mailer layout (mailer.html.erb)
  2. Use stylesheet_link_tag in the layout (e.g:<%= stylesheet_link_tag "mailer", media: "all" %>)
  3. Attempt to generate an email
  4. Observe that the following exception is raised:
ActionView::Template::Error: undefined method `send_early_hints' for nil:NilClass

Expected behavior

The link should be generated without an exception, and without early hints.

Actual behavior

The helper attempts to call request.send_early_hints, which raises an exception because request is nil: https://github.com/rails/rails/blob/v5.2.0.beta2/actionview/lib/action_view/helpers/asset_tag_helper.rb#L143

System configuration

Rails version: 5.2.0.beta2

Ruby version: Ruby 2.4.0

@tcannonfodder tcannonfodder changed the title ActionView::Helpers::AssetTagHelper breaks if the request object is nil ActionView::Helpers::AssetTagHelper javascript/css link helpers break if the request object is nil Nov 28, 2017
@mokolabs
Copy link

I just ran into this issue while setting up a mailer in a new app using Rails 5.2beta2.

Why was this issue closed without comment? Is there a fix or workaround in place?

Thanks!

@madrobby
Copy link
Contributor

@mokolabs See above, it was fixed and committed in 6121463 (idk if it made it into a beta yet)

@mokolabs
Copy link

@madrobby Got it. Thanks for the update! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants