Module: Waves::Helpers::View

Included in:
Extended, Renderers::Haml::Scope
Defined in:
lib/helpers/view.rb

Overview

View helpers are intended to help reuse views from within other views. Both the layout method in the common helpers and the property method of the form helpers are specialized instance of this.

The star of our show here is the view method. This takes a model, view, and assigns hash (which are converted into instance variables in the target view) and returns the result of evaluating the view as content in the current template.

Instance Method Summary collapse

Instance Method Details

#view(model, view, assigns = {}) ⇒ Object

Invokes the view for the given model, passing the assigns as instance variables.



15
16
17
# File 'lib/helpers/view.rb', line 15

def view( model, view, assigns = {} )
  self << Waves.main::Views[ model ].new( request ).send( view, assigns )
end