mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Regenerate AV::Base subclass when DetailsKey gets cleared
This commit is contained in:
parent
f9bea6304d
commit
5b4df9d0eb
2 changed files with 29 additions and 3 deletions
|
@ -186,8 +186,13 @@ module ActionView #:nodoc:
|
|||
Class.new(self) {
|
||||
include template_container
|
||||
define_method(:compiled_method_container) { template_container }
|
||||
define_singleton_method(:compiled_method_container) { template_container }
|
||||
}
|
||||
end
|
||||
|
||||
def changed?(other) # :nodoc:
|
||||
compiled_method_container != other.compiled_method_container
|
||||
end
|
||||
end
|
||||
|
||||
attr_reader :view_renderer
|
||||
|
|
|
@ -35,14 +35,35 @@ module ActionView
|
|||
end
|
||||
|
||||
module ClassMethods
|
||||
def _routes
|
||||
end
|
||||
|
||||
def _helpers
|
||||
end
|
||||
|
||||
def build_av_class(klass, supports_path, routes, helpers)
|
||||
Class.new(klass) do
|
||||
if routes
|
||||
include routes.url_helpers(supports_path)
|
||||
include routes.mounted_helpers
|
||||
end
|
||||
|
||||
if helpers
|
||||
include helpers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def view_context_class
|
||||
klass = ActionView::LookupContext::DetailsKey.view_context_class(ActionView::Base)
|
||||
|
||||
@view_context_class ||= build_view_context_class(klass, supports_path?, _routes, _helpers)
|
||||
@view_context_class ||= build_av_class(klass, supports_path?, _routes, _helpers)
|
||||
|
||||
if klass.changed?(@view_context_class)
|
||||
@view_context_class = build_view_context_class(klass, supports_path?, _routes, _helpers)
|
||||
@view_context_class = build_av_class(klass, supports_path?, _routes, _helpers)
|
||||
end
|
||||
|
||||
@view_context_class
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue