method

new

new(lookup_context = nil, assigns = {}, controller = nil, formats = NULL)
public

No documentation available.

# File actionview/lib/action_view/base.rb, line 241
    def initialize(lookup_context = nil, assigns = {}, controller = nil, formats = NULL) #:nodoc:
      @_config = ActiveSupport::InheritableOptions.new

      unless formats == NULL
        ActiveSupport::Deprecation.warn <<~eowarn.squish
        Passing formats to ActionView::Base.new is deprecated
        eowarn
      end

      case lookup_context
      when ActionView::LookupContext
        @lookup_context = lookup_context
      else
        ActiveSupport::Deprecation.warn <<~eowarn.squish
        ActionView::Base instances should be constructed with a lookup context,
        assignments, and a controller.
        eowarn
        @lookup_context = self.class.build_lookup_context(lookup_context)
      end

      @view_renderer = ActionView::Renderer.new @lookup_context
      @current_template = nil

      @cache_hit = {}
      assign(assigns)
      assign_controller(controller)
      _prepare_context
    end

1Note

When using ActionView::Base.new to render templates views

carlos_roque ยท Apr 17, 2018

when calling this method to render templates to a string. in order to use any helper methods you need to add them to the view like this

view = ActionView::Base.new(ActionController::Base.view_paths, {})
view.class_eval do  
# include any needed helpers (for the view)
include ApplicationHelper
end 

source: http://peden.biz/rendering-a-rails-view-from-a-script/