Skip to Content Skip to Search

module ActionView::LookupContext::ViewPaths

Helpers related to template lookup using the lookup context information.

Attributes

[R] html_fallback_for_js
[R] view_paths

Public instance methods

Also aliased as: any_templates?.

Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 148
def any?(name, prefixes = [], partial = false)
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for_any
  @view_paths.exists?(name, prefixes, partial, details, details_key, [])
end

Alias for: any?.

Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 155
def append_view_paths(paths)
  @view_paths = build_view_paths(@view_paths.to_a + paths)
end

Also aliased as: template_exists?.

Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 141
def exists?(name, prefixes = [], partial = false, keys = [], **options)
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for(options)
  @view_paths.exists?(name, prefixes, partial, details, details_key, keys)
end

Also aliased as: find_template.

Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 128
def find(name, prefixes = [], partial = false, keys = [], options = {})
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for(options)
  @view_paths.find(name, prefixes, partial, details, details_key, keys)
end
Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 135
def find_all(name, prefixes = [], partial = false, keys = [], options = {})
  name, prefixes = normalize_name(name, prefixes)
  details, details_key = detail_args_for(options)
  @view_paths.find_all(name, prefixes, partial, details, details_key, keys)
end

Alias for: find.

Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 159
def prepend_view_paths(paths)
  @view_paths = build_view_paths(paths + @view_paths.to_a)
end

Alias for: exists?.

Private instance methods

Compute details hash and key according to user options (e.g. passed from render).

Source code GitHub
# File actionview/lib/action_view/lookup_context.rb, line 175
def detail_args_for(options) # :doc:
  return @details, details_key if options.empty? # most common path.
  user_details = @details.merge(options)

  if @cache
    details_key = DetailsKey.details_cache_key(user_details)
  else
    details_key = nil
  end

  [user_details, details_key]
end

Definition files