#1 new
Renaud Morvan

Liquid template handler is broken in Rails2.1

Reported by Renaud Morvan | June 1st, 2008 @ 03:14 PM

Due to the big Rails2.1 internal refactoring of template handling.

render ... :type => :liquid does not work anymore.

This is due to liquid_view.rb that still use a legacy interface.

Here is a handler compatible with rails2.1:

class LiquidView < ActionView::TemplateHandler

def compilable?

false

end

#def cache_fragment(block, name = {}, options = nil)

  1. no cache fragment for now

#end

def render(template)

liquid = Liquid::Template.parse(template.source)

liquid.render(@view.assigns, :filters => [@view.controller.master_helper_module], :registers => {:action_view => @view, :controller => @view.controller})

end

end

The problem is that if you want a handler compatible with Rails2.1- and Rails2.1+ you will have to add a condition exemple:

if defined?(ActionView::TemplateHandlers::Compilable)

Rails2.1 version

else

Rails2.0- version

end

I did not succeed in making the template handler using liquid in compilable mode but I did not spend too much time checking the liquid internals to see if it was doable

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Safe template language

People watching this ticket