How do I use the ProductDecorator with related objects (products)?
Controller:
def show
@category = Category.find(params[:id])
end
Product decorator:
decorate :product
def somevalue
'somevalue'
end
View:
<%= render partial: 'list_item', collection: @category.products %>
Partial:
<%= list_item.somevalue %>
You need to call
ProductDecorator.decorateon theProducts collection like this: