• P
    Use superclass name in inspect of ActionView::Base.with_empty_template_cache · a7ed92bd
    Petrik 提交于
    When rendering views an anonymous subclass is created by calling
    ActionView::Base.with_empty_template_cache.
    This causes inspect to return an unhelpful description when calling
    inspect:
    `#<#<Class:0x012345012345>:<0x012345012345>`.
    
    This can be confusing when exceptions are raised because it's hard to
    figure out where to look. For example calling an undefined method in a
    template would raise the following exception:
    
        undefined method `undefined' for #<#<Class:0x012345012345>:<0x012345012345>
    
    Instead we can return the non-anonymous superclass name.
    
        undefined method `undefined' for #<ActionView::Base:0x01234502345>
    
    The anonymous class is created in ActionView::Base.with_empty_template_cache.
    See f9bea630
    This seems to be done for performance reasons only, without expecting a
    change to calling `inspect`.
    a7ed92bd
base.rb 11.9 KB