Skip to content

Commit

Permalink
Don't override module name on AV::Base subclass
Browse files Browse the repository at this point in the history
We should avoid overriding name if possible because it is confusing to
developers and it also can causes bugs in code which deal with modules
but aren't using the Module.instance_method(:name).bind workaround.

I believe we can achieve the desired "method missing" behaviour by just
redefining inspect.

Refs rails#39819
  • Loading branch information
jhawthorn committed Sep 2, 2020
1 parent 9055156 commit 91ae9df
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions actionview/lib/action_view/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,8 @@ def with_empty_template_cache # :nodoc:
define_method(:compiled_method_container) { subclass }
define_singleton_method(:compiled_method_container) { subclass }

def self.name
superclass.name
end

def inspect
"#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>"
"#<ActionView::Base:#{'%#016x' % (object_id << 1)}>"
end
}
end
Expand Down

0 comments on commit 91ae9df

Please sign in to comment.