Module: AbstractController::ViewPaths::ClassMethods

Defined in:
actionpack/lib/abstract_controller/view_paths.rb,
actionpack/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::PathSet for more information)


67
68
69
# File 'actionpack/lib/abstract_controller/view_paths.rb', line 67

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

#parent_prefixesObject


17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'actionpack/lib/abstract_controller/view_paths.rb', line 17

def parent_prefixes
  @parent_prefixes ||= begin
    parent_controller = superclass
    prefixes = []

    until parent_controller.abstract?
      prefixes << parent_controller.controller_path
      parent_controller = parent_controller.superclass
    end

    prefixes
  end
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::PathSet for more information)


77
78
79
# File 'actionpack/lib/abstract_controller/view_paths.rb', line 77

def prepend_view_path(path)
  self._view_paths = ActionView::PathSet.new(Array(path) + view_paths)
end

#view_pathsObject

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


82
83
84
# File 'actionpack/lib/abstract_controller/view_paths.rb', line 82

def view_paths
  _view_paths
end

#view_paths=(paths) ⇒ Object

Set the view paths.

Parameters

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


91
92
93
# File 'actionpack/lib/abstract_controller/view_paths.rb', line 91

def view_paths=(paths)
  self._view_paths = ActionView::PathSet.new(Array.wrap(paths))
end