method

new

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

No documentation available.

# File actionpack/lib/action_view/base.rb, line 212
    def initialize(lookup_context = nil, assigns_for_first_render = {}, controller = nil, formats = nil) #:nodoc:
      assign(assigns_for_first_render)
      self.helpers = self.class.helpers || Module.new

      if @_controller = controller
        @_request = controller.request if controller.respond_to?(:request)
      end

      config = controller && controller.respond_to?(:config) ? controller.config : {}
      @_config = ActiveSupport::InheritableOptions.new(config)

      @_content_for  = Hash.new { |h,k| h[k] = ActiveSupport::SafeBuffer.new }
      @_virtual_path = nil
      @output_buffer = nil

      @lookup_context = lookup_context.is_a?(ActionView::LookupContext) ?
        lookup_context : ActionView::LookupContext.new(lookup_context)
      @lookup_context.formats = formats if formats
      @controller = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :controller)
    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/