I need to avoid an often repeat of the same code block into template. Example:
%a{href:item_path(item.web_title,@relative_link_options)}
=item.show_field_locale('title')
-unless item.get_image_path('has_image',"item_#{item.id}.png").blank?
=image_tag(item.get_image_path('has_image',"item_#{item.id}.png"))
So, I describe many items, NOT from collection @items. That are has-one relations or small has-many relations. I have a lot of such pages, so too many different content for caching.
To display every item I need to repeat an above code block.
Also I could use partial _item.html.haml
and use it via render partial: 'item'
But it slows an application (time to prepare Views in ms).
How could I avoid it?