Skip to content

Instantly share code, notes, and snippets.

@SLiNv
Created April 11, 2019 02:23

Revisions

  1. SLiNv created this gist Apr 11, 2019.
    17 changes: 17 additions & 0 deletions find_templates.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    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

    def query(path, details, formats, outside_app_allowed)
    query = build_query(path, details)
    template_paths = find_template_paths(query)
    ...
    end
    end