diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-24 12:43:07 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-06 16:57:34 -0800 |
commit | 517b96207d0e083a42b81414efa9f9b6ba300e03 (patch) | |
tree | 53bef0178456e1b323dd0e3a41819dad88bf4305 /actionview/lib/action_view | |
parent | 6dcd43b2a8a81b6131f5a569fffae6a17d337032 (diff) | |
download | rails-517b96207d0e083a42b81414efa9f9b6ba300e03.tar.gz rails-517b96207d0e083a42b81414efa9f9b6ba300e03.tar.bz2 rails-517b96207d0e083a42b81414efa9f9b6ba300e03.zip |
Pull generated methods up in to the anonymous subclass
Then we don't need the extra module.
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/base.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index c5d8cdd409..71aa68499d 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -182,11 +182,12 @@ module ActionView #:nodoc: end def with_empty_template_cache # :nodoc: - template_container = Module.new - Class.new(self) { - include template_container - define_method(:compiled_method_container) { template_container } - define_singleton_method(:compiled_method_container) { template_container } + subclass = Class.new(self) { + # We can't implement these as self.class because subclasses will + # share the same template cache as superclasses, so "changed?" won't work + # correctly. + define_method(:compiled_method_container) { subclass } + define_singleton_method(:compiled_method_container) { subclass } } end |