Class: Mack::Rendering::Type::Layout
- Defined in:
- lib/mack/rendering/type/layout.rb
Overview
Used to render layouts around views.
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/layouts/#{options[:layout] || "application"}.#{format (html, xml, js, etc...)}.#{extension defined in the engine}
Example:
app/views/layouts/application.html.erb
14 15 16 17 18 19 20 21 22 |
# File 'lib/mack/rendering/type/layout.rb', line 14 def render l_file = Mack::Paths.layouts("#{self.[:layout]}.#{self.[:format]}") begin render_file(l_file, :layout) rescue Mack::Errors::ResourceNotFound => e Mack.logger.warn(e) self.view_template.yield_to :view end end |