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

uninitialized constant ActionView::Template::Handlers::ERB::Erubi (NameError) #1011

Closed
wyattisimo opened this issue May 8, 2019 · 4 comments

Comments

@wyattisimo
Copy link

wyattisimo commented May 8, 2019

I'm getting "uninitialized constant ActionView::Template::Handlers::ERB::Erubi (NameError)" on line 37 of haml/lib/haml/railtie.rb:

haml/lib/haml/railtie.rb

Lines 36 to 37 in c1b38ed

if defined?(::Erubi) && const_defined?('ActionView::Template::Handlers::ERB::Erubi') &&
ActionView::Template::Handlers::ERB::Erubi != ::Erubi

Dumping some context...

const_defined?('::Erubi') #=> true

defined?(::Erubi) #=> constant

const_defined?('ActionView::Template::Handlers::ERB::Erubi') #=> true

defined?(ActionView::Template::Handlers::ERB::Erubi) #=> nil

I'm using MRI v2.6.3 and Rails v4.2.11.1. Any clue what's going on here? Why would const_defined? say a constant by that name exists, but defined? doesn't recognize it? Is there possibly a scoping issue?

@nickhammond
Copy link
Contributor

@wyattisimo Some useful context around Erubi in #946, similar issue.

@amatsuda
Copy link
Member

Thank you for reporting this!

This seems like a ruby's bug to me. https://bugs.ruby-lang.org/issues/15875
But for now we need a fix in Haml's side not to hit this const_defined? bug.

@amatsuda
Copy link
Member

amatsuda commented May 25, 2019

So, this used to be happening only when you're using rails 4.2.x with haml 5.1.0, and bundling erubi or something that depends on erubi (e.g. better_errors), and running them on ruby 2.6.1-2.6.3.

Now it's been fixed via 9374849 and 09cb8ef, hopefully.

@amatsuda
Copy link
Member

This has to be fixed in 5.1.1 release https://rubygems.org/gems/haml/versions/5.1.1
Please let us know if you're still seeing this problem with 5.1.1 or newer.

stevecrozz pushed a commit to errbit/errbit that referenced this issue Nov 23, 2019
- Fixes uninitialized constant ActionView::Template::Handlers::ERB::Erubi
- See haml/haml#1011
matzko pushed a commit to wecounsel/errbit that referenced this issue Feb 4, 2020
- Fixes uninitialized constant ActionView::Template::Handlers::ERB::Erubi
- See haml/haml#1011
VorontsovIE added a commit to autosome-ru/epifactors_webapp that referenced this issue Jun 25, 2020
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