Module: Cell::ViewModel::Partial

Defined in:
lib/cell/partial.rb

Overview

Allows to render global partials, for example.

render partial: "../views/shared/container"

Instance Method Summary collapse

Instance Method Details

#process_options!(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cell/partial.rb', line 5

def process_options!(options)
  super
  return unless partial = options[:partial]

  parts     = partial.split("/")
  view      = parts.pop
  view      = "_#{view}"
  view     += ".#{options[:formats].first}" if options[:formats]
  prefixes  = self.class.view_paths.collect { |path| ([path] + parts).join("/") }

  options.merge!(view: view, prefixes: prefixes)
end