Module: ActionView::LookupContext::ViewPaths

Included in:
ActionView::LookupContext
Defined in:
actionpack/lib/action_view/lookup_context.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) view_paths

Returns the value of attribute view_paths



72
73
74
# File 'actionpack/lib/action_view/lookup_context.rb', line 72

def view_paths
  @view_paths
end

Instance Method Details

- (Boolean) exists?(name, prefix = nil, partial = false) Also known as: template_exists?



89
90
91
# File 'actionpack/lib/action_view/lookup_context.rb', line 89

def exists?(name, prefix = nil, partial = false)
  @view_paths.exists?(*args_for_lookup(name, prefix, partial))
end

- (Object) find(name, prefix = nil, partial = false) Also known as: find_template



80
81
82
# File 'actionpack/lib/action_view/lookup_context.rb', line 80

def find(name, prefix = nil, partial = false)
  @view_paths.find(*args_for_lookup(name, prefix, partial))
end

- (Object) find_all(name, prefix = nil, partial = false)



85
86
87
# File 'actionpack/lib/action_view/lookup_context.rb', line 85

def find_all(name, prefix = nil, partial = false)
  @view_paths.find_all(*args_for_lookup(name, prefix, partial))
end

- (Object) with_fallbacks

Add fallbacks to the view paths. Useful in cases you are rendering a :file.



95
96
97
98
99
100
101
102
103
104
105
# File 'actionpack/lib/action_view/lookup_context.rb', line 95

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