From 292c3942025cb5f90d81d0a85ceadc99ffe20230 Mon Sep 17 00:00:00 2001 From: Ben Polinsky Date: Sun, 3 Jul 2016 16:41:04 -0400 Subject: [PATCH] Updated Liquid for Programmers (markdown) --- Liquid-for-Programmers.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Liquid-for-Programmers.md b/Liquid-for-Programmers.md index 13b747d..8fb894d 100644 --- a/Liquid-for-Programmers.md +++ b/Liquid-for-Programmers.md @@ -142,6 +142,11 @@ or @template.render('multiply_by' => 3) # => 15 ``` +## Difference Between Assigns and Registers +When you render a template, you can pass it assigns and registers. The difference is subtle: assigns are exposed to the template, while registers are exposed to Drops, Tags, and Filters. +``` +@template.render({}, registers: { user: @user }) +``` ### Create your own tag blocks @@ -179,10 +184,4 @@ If you get errors like `A copy of ... has been removed from the module tree but ```ruby # in config/environments/development.rb and config/environments/test.rb Liquid.cache_classes = false -``` - -## Difference Between Assigns and Registers -When you render a template, you can pass it assigns and registers. The difference is subtle: assigns are exposed to the template, while registers are exposed to Drops, Tags, and Filters. -``` -@template.render({}, registers: { user: @user }) ``` \ No newline at end of file