Class: Mack::Rendering::Type::Template
- Defined in:
- lib/mack/rendering/type/template.rb
Overview
Pretty much the same thing as Mack::Rendering::Type::Action, except the template is relative to the app/views directory, and not the app/views/#name directory like action.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#render ⇒ Object
See Mack::Rendering::Type::FileBase render_file for more information.
Methods inherited from FileBase
Methods inherited from Base
#allow_layout?, #capture, #controller_view_path, #find_engine, #find_file, #initialize, #method_missing
Constructor Details
This class inherits a constructor from Mack::Rendering::Type::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Mack::Rendering::Type::Base
Instance Method Details
#render ⇒ Object
See Mack::Rendering::Type::FileBase render_file for more information.
The path to the file is built like such:
app/views/#{template (show, index, etc...)}.#{format (html, xml, js, etc...)}.#{extension defined in the engine}
Example:
<%= render(:template, "users/show") %> # => app/views/users/show.html.erb
15 16 17 18 |
# File 'lib/mack/rendering/type/template.rb', line 15 def render t_file = Mack::Paths.views("#{self._render_value}.#{self.[:format]}") render_file(t_file, :template) end |