Module: AbstractController::ViewPaths::ClassMethods

Defined in:
lib/abstract_controller/view_paths.rb

Instance Method Summary collapse

Instance Method Details

#append_view_path(path) ⇒ Object

Append a path to the list of view paths for this controller.

Parameters

  • path - If a String is provided, it gets converted into the default view path. You may also provide a custom view path (see ActionView::ViewPathSet for more information)



40
41
42
# File 'lib/abstract_controller/view_paths.rb', line 40

def append_view_path(path)
  self.view_paths = view_paths.dup + Array(path)
end

#prepend_view_path(path) ⇒ Object

Prepend a path to the list of view paths for this controller.

Parameters

  • path - If a String is provided, it gets converted into the default view path. You may also provide a custom view path (see ActionView::ViewPathSet for more information)



50
51
52
# File 'lib/abstract_controller/view_paths.rb', line 50

def prepend_view_path(path)
  self.view_paths = Array(path) + view_paths.dup
end

#view_pathsObject

A list of all of the default view paths for this controller.



55
56
57
# File 'lib/abstract_controller/view_paths.rb', line 55

def view_paths
  _view_paths
end

#view_paths=(paths) ⇒ Object

Set the view paths.

Parameters

  • paths - If a ViewPathSet is provided, use that; otherwise, process the parameter into a ViewPathSet.



64
65
66
67
# File 'lib/abstract_controller/view_paths.rb', line 64

def view_paths=(paths)
  self._view_paths = ActionView::Base.process_view_paths(paths)
  self._view_paths.freeze
end