Module: Workarea::JbuilderAppendPartials

Defined in:
lib/workarea/ext/jbuilder/jbuilder_append_partials.rb

Instance Method Summary collapse

Instance Method Details

#append_partials(name, locals = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/workarea/ext/jbuilder/jbuilder_append_partials.rb', line 3

def append_partials(name, locals = {})
  appends = ::Workarea::Plugin.partials_appends[name]
  return if appends.blank?

  appends.inject([]) do |arr, paths|
    Array.wrap(paths).each do |path|
      @context.render(partial: path, locals: locals.merge(json: self))
    end
  end
end