Module: ActionView::LookupContext::ViewPaths
- Included in:
- ActionView::LookupContext
- Defined in:
- actionpack/lib/action_view/lookup_context.rb
Instance Attribute Summary (collapse)
-
- (Object) view_paths
Returns the value of attribute view_paths.
Instance Method Summary (collapse)
- - (Boolean) exists?(name, prefixes = [], partial = false, keys = []) (also: #template_exists?)
- - (Object) find(name, prefixes = [], partial = false, keys = []) (also: #find_template)
- - (Object) find_all(name, prefixes = [], partial = false, keys = [])
-
- (Object) with_fallbacks
Add fallbacks to the view paths.
Instance Attribute Details
- (Object) view_paths
Returns the value of attribute view_paths
76 77 78 |
# File 'actionpack/lib/action_view/lookup_context.rb', line 76 def view_paths @view_paths end |
Instance Method Details
- (Boolean) exists?(name, prefixes = [], partial = false, keys = []) Also known as: template_exists?
93 94 95 |
# File 'actionpack/lib/action_view/lookup_context.rb', line 93 def exists?(name, prefixes = [], partial = false, keys = []) @view_paths.exists?(*args_for_lookup(name, prefixes, partial, keys)) end |
- (Object) find(name, prefixes = [], partial = false, keys = []) Also known as: find_template
84 85 86 |
# File 'actionpack/lib/action_view/lookup_context.rb', line 84 def find(name, prefixes = [], partial = false, keys = []) @view_paths.find(*args_for_lookup(name, prefixes, partial, keys)) end |
- (Object) find_all(name, prefixes = [], partial = false, keys = [])
89 90 91 |
# File 'actionpack/lib/action_view/lookup_context.rb', line 89 def find_all(name, prefixes = [], partial = false, keys = []) @view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys)) end |
- (Object) with_fallbacks
Add fallbacks to the view paths. Useful in cases you are rendering a :file.
99 100 101 102 103 104 105 106 107 108 109 |
# File 'actionpack/lib/action_view/lookup_context.rb', line 99 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 } end |