theforeman / safemode

A library for safe evaluation of Ruby code based on ParseTree/RubyParser and Ruby2Ruby. Provides Rails ActionView template handlers for ERB and Haml.
http://www.artweb-design.de
MIT License
68 stars 20 forks source link

Allow safemode to work with rails with zeitwerk #36

Closed adamruzicka closed 2 years ago

adamruzicka commented 3 years ago

Zeitwerk handles singleton and "regular" classes differently. For this to work, it needs to be able to detect if a class is a singleton or not. This was not exposed for jails, leading to error like NoMethodError: undefined method `singleton_class?' for #.

ezr-ondrej commented 2 years ago

Could we get this in?

lzap commented 2 years ago

Hello, anybody could take a look on the patch? See https://github.com/svenfuchs/safemode/issues/41 for more discussion about the pace of reviews, thanks!

ares commented 2 years ago

@ezr-ondrej have you tested this? I suppose we need that for Rails 6.1+ support (with Zeitwerk enabled)