Question

I want to change view paths for render call (partial):

vp1 = ActionView::PathSet.new
vp1.prefixes << 'bla1'
render partial: 'abc', view_paths: vp1

vp2 = ActionView::PathSet.new
vp2.prefixes << 'bla2'
render partial: 'abc', view_paths: vp2

Such as prepend_view_paths but for ONE render. How can I do it?

Était-ce utile?

La solution

You probably could add specific paths before render and delete after.

self._view_paths.paths << "/home/someone/..."
render(partial: ...)

# after filter
self._view_paths.paths.delete("/home/someone/")
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top