Module: Enki::HostHelper

Included in:
ApplicationController
Defined in:
app/helpers/enki/host_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_enki(options) ⇒ Object

A simplistic way of skipping the host app view paths and rendering a file directly from a Rails::Engine. An engine can technically have multiple app/views paths. This method uses only the first defined one.

TODO: Add support for rendering methods other than :file.



8
9
10
11
12
13
14
15
16
# File 'app/helpers/enki/host_helper.rb', line 8

def render_enki(options)
  if options[:file]
    render options.merge(:file => File.join(Enki::Engine.paths['app/views'].first.to_s, options[:file]))
  elsif options[:page]
    render_enki(:file => 'enki/pages/show', :locals => { :page => options[:page] })
  else
    raise ArgumentError, 'Unsupported render method.'
  end
end