Hi Nick,
You
say we don’t distinguish between view and partial – there’s no need for making thing more complex. Everything is a view… or a partial. We simply call it view.
In my app I want to render a collection and the natural way to do this is to use a partial:
<%= render :partial => :image, collection: @item.images %>
The view containing this is in my "item" widget (e.g. at "app/widgets/items/item/display.html.erb") but it looks for the partial in "app/widgets/items/image/_image.html.erb"
I would prefer it if it looked in "app/widgets/items/item/_image.html.erb"
If I change the above to
<%= render :view => :image, collection: @item.images %>
then it does look in the right place (the file name needs the underscore removed). However, as far as I can tell, rendering a view doesn't iterate over a collection.
Is there a reason why using render partial looks for the file in a different directory? Can it be coerced to look in the widget's directory?
Thanks,
John