Helpers related to template lookup using the lookup context information.
Methods
- any?
- any_templates?
- detail_args_for
- exists?
- find
- find_all
- find_file
- find_template
- template_exists?
- view_paths=
- with_fallbacks
Attributes
| [R] | html_fallback_for_js | |
| [R] | view_paths | 
Instance Public methods
any?(name, prefixes = [], partial = false)
              Also aliased as: any_templates?
            
          
          
          
          
            📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 133
      def any?(name, prefixes = [], partial = false)
        @view_paths.exists?(*args_for_any(name, prefixes, partial))
      endexists?(name, prefixes = [], partial = false, keys = [], **options)
              Also aliased as: template_exists?
            
          
          
          
          
            📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 128
      def exists?(name, prefixes = [], partial = false, keys = [], **options)
        @view_paths.exists?(*args_for_lookup(name, prefixes, partial, keys, options))
      endfind(name, prefixes = [], partial = false, keys = [], options = {})
              Also aliased as: find_template
            
          
          
          
          
            📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 115
      def find(name, prefixes = [], partial = false, keys = [], options = {})
        @view_paths.find(*args_for_lookup(name, prefixes, partial, keys, options))
      endfind_all(name, prefixes = [], partial = false, keys = [], options = {})
📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 124
      def find_all(name, prefixes = [], partial = false, keys = [], options = {})
        @view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys, options))
      endfind_file(name, prefixes = [], partial = false, keys = [], options = {})
📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 120
      def find_file(name, prefixes = [], partial = false, keys = [], options = {})
        @view_paths.find_file(*args_for_lookup(name, prefixes, partial, keys, options))
      endview_paths=(paths)
Whenever setting view paths, makes a copy so that we can manipulate them in instance objects as we wish.
📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 111
      def view_paths=(paths)
        @view_paths = ActionView::PathSet.new(Array(paths))
      endwith_fallbacks()
Adds fallbacks to the view paths. Useful in cases when you are rendering a :file.
📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 140
      def with_fallbacks
        added_resolvers = 0
        self.class.fallbacks.each do |resolver|
          next if view_paths.include?(resolver)
          view_paths.push(resolver)
          added_resolvers += 1
        end
        yield
      ensure
        added_resolvers.times { view_paths.pop }
      endInstance Private methods
detail_args_for(options)
Compute details hash and key according to user options (e.g. passed from render).
📝 Source code
# File actionview/lib/action_view/lookup_context.rb, line 161
      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.get(user_details)
        else
          details_key = nil
        end
        [user_details, details_key]
      end