Methods
- accessible_paths
- content_type
- exempt_from_layout
- exempt_from_layout?
- format_and_extension
- load!
- method_segment
- mime_type
- multipart?
- new
- path
- path_without_extension
- path_without_format_and_extension
- relative_path
- render_template
- source
Included Modules
- Renderable
Classes and Modules
Class ActionView::Template::EagerPathClass ActionView::Template::Path
Attributes
| [RW] | base_path | |
| [RW] | extension | |
| [RW] | filename | |
| [RW] | format | |
| [RW] | load_path | |
| [RW] | locale | |
| [RW] | name | |
| [RW] | template_path |
Public Class methods
Don‘t render layouts for templates with the given extensions.
# File actionpack/lib/action_view/template.rb, line 99
99: def self.exempt_from_layout(*extensions)
100: regexps = extensions.collect do |extension|
101: extension.is_a?(Regexp) ? extension : /\.#{Regexp.escape(extension.to_s)}$/
102: end
103: @@exempt_from_layout.merge(regexps)
104: end
# File actionpack/lib/action_view/template.rb, line 110
110: def initialize(template_path, load_path)
111: @template_path = template_path.dup
112: @load_path, @filename = load_path, File.join(load_path, template_path)
113: @base_path, @name, @locale, @format, @extension = split(template_path)
114: @base_path.to_s.gsub!(/\/$/, '') # Push to split method
115:
116: # Extend with partial super powers
117: extend RenderablePartial if @name =~ /^_/
118: end
Public Instance methods
# File actionpack/lib/action_view/template.rb, line 120
120: def accessible_paths
121: paths = []
122:
123: if valid_extension?(extension)
124: paths << path
125: paths << path_without_extension
126: if multipart?
127: formats = format.split(".")
128: paths << "#{path_without_format_and_extension}.#{formats.first}"
129: paths << "#{path_without_format_and_extension}.#{formats.second}"
130: end
131: else
132: # template without explicit template handler should only be reachable through its exact path
133: paths << template_path
134: end
135:
136: paths
137: end
# File actionpack/lib/action_view/template.rb, line 193
193: def render_template(view, local_assigns = {})
194: render(view, local_assigns)
195: rescue Exception => e
196: raise e unless filename
197: if TemplateError === e
198: e.sub_template_of(self)
199: raise e
200: else
201: raise TemplateError.new(self, view.assigns, e)
202: end
203: end