From ec5658e95cbf2270eac8b03fe8562a0433609ef4 Mon Sep 17 00:00:00 2001 From: Julian Nadeau Date: Wed, 25 Jun 2014 10:04:24 -0700 Subject: [PATCH] Added Multiple Drops example, added comments in the code to clarify a string is needed for assigns --- Introduction-to-Drops.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Introduction-to-Drops.md b/Introduction-to-Drops.md index 252d31f..7204f07 100644 --- a/Introduction-to-Drops.md +++ b/Introduction-to-Drops.md @@ -62,8 +62,17 @@ Returns the drop instance. file = File.read(product_view.liquid) template = Liquid::Template.parse(file) drop = ProductDrop.new(@product) - template.render('product' => drop) + template.render('product' => drop) # Please note the hash assignment is a string, not a symbol ### View - Viewing product: {{ product.name }}

{{ product.description }}
£{{ product.price }} \ No newline at end of file + Viewing product: {{ product.name }}

{{ product.description }}
£{{ product.price }} + +### Multiple Drops +You can use assigns to assign multiple drops before you call render. This can be useful to keep the render statement clean, while still maintaining functionality. + + file = File.read(product_view.liquid) + template = Liquid::Template.parse(file) + template.assigns['product'] = ProductDrop.new(@product) # Please note the hash assignment is a string, not a symbol + template.assigns['collections'] = CollectionDrop.new(@product.collections) + template.render