This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PathResolver < Resolver #:nodoc: | |
EXTENSIONS = { locale: ".", formats: ".", variants: "+", handlers: "." } | |
DEFAULT_PATTERN = ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}" | |
... | |
private | |
def find_templates(name, prefix, partial, details, outside_app_allowed = false) | |
path = Path.build(name, prefix, partial) | |
# Note details and details[:formats] are used here | |
query(path, details, details[:formats], outside_app_allowed) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_all_anywhere(name, prefix, partial = false, details = {}, key = nil, locals = []) | |
cached(key, [name, prefix, partial], details, locals) do | |
find_templates(name, prefix, partial, details, true) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PathSet #:nodoc: | |
def find_file(path, prefixes = [], *args) | |
_find_all(path, prefixes, args, true).first || raise(MissingTemplate.new(self, path, prefixes, *args)) | |
end | |
private | |
def _find_all(path, prefixes, args, outside_app) | |
prefixes = [prefixes] if String === prefixes | |
prefixes.each do |prefix| | |
paths.each do |resolver| | |
if outside_app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_file(name, prefixes = [], partial = false, keys = [], options = {}) | |
@view_paths.find_file(*args_for_lookup(name, prefixes, partial, keys, options)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionView | |
class TemplateRenderer < AbstractRenderer #:nodoc: | |
# Determine the template to be rendered using the given options. | |
def determine_template(options) | |
keys = options.has_key?(:locals) ? options[:locals].keys : [] | |
if options.key?(:body) | |
... | |
elsif options.key?(:file) | |
with_fallbacks { find_file(options[:file], nil, false, keys, @details) } | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChybetaController < ApplicationController | |
def index | |
render file: "#{Rails.root}/README.md" | |
end | |
end |