Sha256: 3d4c6e9165a1e79ca915f8b67660dde6434f821d3ae27366c99caf3d95214a1e
Contents?: true
Size: 880 Bytes
Versions: 196
Compression:
Stored size: 880 Bytes
Contents
module Jets::RenderingHelper # ensure that we always add the controller view name. So when rendering # a partial: # <%= render "mypartial" %> # gets turned into: # <%= render "articles/mypartial" %> def render(options = {}, locals = {}, &block) if options.is_a?(String) && !options.include?('/') folder = _get_containing_folder(caller[0]) partial_name = options # happens to be the partial name partial_name = "#{folder}/#{partial_name}" options = partial_name end super(options, locals, &block) end # Ugly, going back up the caller stack to find out what view path # we are in def _get_containing_folder(caller_line) text = caller_line.split(':').first # .../fixtures/apps/demo/app/views/posts/index.html.erb text.split('/')[-2] # posts end end ActionView::Helpers.send(:include, Jets::RenderingHelper)
Version data entries
196 entries across 196 versions & 3 rubygems