Module: ActionController::PartialHelper
- Defined in:
- lib/vex/action_controller/partial_helper.rb
Instance Method Summary collapse
-
#partial(partial, object = nil, locals = nil) ⇒ Object
partial <partial-name>, <object>, <locals> or partial <object>, <locals>.
- #partial?(*args) ⇒ Boolean
- #partial_for(name) ⇒ Object
Instance Method Details
#partial(partial, object = nil, locals = nil) ⇒ Object
partial <partial-name>, <object>, <locals> or partial <object>, <locals>
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vex/action_controller/partial_helper.rb', line 14 def partial(partial, object=nil, locals=nil) # # set up object and locals unless partial.is_a?(String) object, locals = partial, object end if !locals && object.is_a?(Hash) locals, object = object, nil end opts = { :partial => partial_for(partial), :locals => locals } if object opts[:object] = object elsif locals && locals[:collection] opts[:collection] = locals[:collection] end if self.is_a?(ActionController::Base) render_to_string(opts) else render(opts) end end |
#partial?(*args) ⇒ Boolean
42 43 44 45 46 47 |
# File 'lib/vex/action_controller/partial_helper.rb', line 42 def partial?(*args) partial *args rescue ActionView::MissingTemplate logger.debug $!.to_s nil end |