Module: Plate::PartialsHelper

Included in:
View
Defined in:
lib/plate/helpers/partials_helper.rb

Overview

Allow for partials within views

Instance Method Summary collapse

Instance Method Details

#render(options = {}, locals = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/plate/helpers/partials_helper.rb', line 4

def render(options = {}, locals = {})
  path = options

  # If a hash is passed as the first option, use it for locals
  if Hash === options
    path = options.delete(:partial)
    locals = options.clone
  end

  locals.symbolize_keys!
  
  render_partial(path.to_s, locals)
rescue
  site.log("Oops. There was a problem rendering the partial: #{path}")
  ""
end