English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

Using Your Partials in Your Liquid Templates


I'm working on a project that requires users/designers be allowed to edit the layout of their site. I'm using Liquid, Ruby templating system developed by the folks at shopify.com.

Doing a little searching I found this great post http://giantrobots.thoughtbot.com/2008/10/3/custom-tags-in-liquid The liquid documentation itself needs a little more work. But you can check it out here if you want http://wiki.github.com/tobi/liquid/liquid-for-programmers.

I worked through the example at thoughtbot blog and was having trouble with the final step, rendering the partial to the screen. The solution was really a simple step I wasn't thinking about. Nonetheless, the information for some reason was kept out of the post and burried in the comments.

<%= Liquid::Template.parse(template).render({}, :registers=>{:controller => controller} %>

Tagged w/ #liquid #rails #rubyruby on rails