Module: ActionView::Rendering::ClassMethods

Defined in:
lib/action_view/rendering.rb

Instance Method Summary collapse

Instance Method Details

#view_context_classObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/action_view/rendering.rb', line 38

def view_context_class
  @view_context_class ||= begin
    supports_path = supports_path?
    routes  = respond_to?(:_routes)  && _routes
    helpers = respond_to?(:_helpers) && _helpers

    Class.new(ActionView::Base) do
      if routes
        include routes.url_helpers(supports_path)
        include routes.mounted_helpers
      end

      if helpers
        include helpers
      end
    end
  end
end