Module: AbstractController::Rendering::ClassMethods

Defined in:
actionpack/lib/abstract_controller/rendering.rb

Instance Method Summary collapse

Instance Method Details

#view_context_classObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'actionpack/lib/abstract_controller/rendering.rb', line 50

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

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

      if helpers
        include helpers
      end
    end
  end
end