title: How to make .liquid file work in Rails 3
body: <p>I am using Rails 3.0.9 . I am trying to use liquid and I am getting an error.</p>
  
  <p>Here is my Gemfile</p>
  
  <pre><code>source 'http://rubygems.org'
  
  gem 'rails', '3.0.9'
  gem 'sqlite3'
  gem 'liquid'
  </code></pre>
  
  <p>Here is an initializer</p>
  
  <pre><code>class LiquidView
    PROTECTED_ASSIGNS = %w( template_root response _session template_class action_name request_origin session template
                            _response url _request _cookies variables_added _flash params _headers request cookies
                            ignore_missing_templates flash _params logger before_filter_chain_aborted headers )
    PROTECTED_INSTANCE_VARIABLES = %w( @_request @controller @_first_render @_memoized__pick_template @view_paths
                                       @helpers @assigns_added @template @_render_stack @template_format @assigns )
  
    def self.call(template)
      "LiquidView.new(self).render(template, local_assigns)"
    end
  
    def initialize(view)
      @view = view
    end
  
    def render(template, local_assigns = nil)
      @view.controller.headers["Content-Type"] ||= 'text/html; charset=utf-8'
  
      # Rails 2.2 Template has source, but not locals
      if template.respond_to?(:source) &amp;&amp; !template.respond_to?(:locals)
        assigns = (@view.instance_variables - PROTECTED_INSTANCE_VARIABLES).inject({}) do |hash, ivar|
                    hash[ivar[1..-1]] = @view.instance_variable_get(ivar)
                    hash
                  end
      else
        assigns = @view.assigns.reject{ |k,v| PROTECTED_ASSIGNS.include?(k) }
      end
  
      source = template.respond_to?(:source) ? template.source : template
      local_assigns = (template.respond_to?(:locals) ? template.locals : local_assigns) || {}
  
      if content_for_layout = @view.instance_variable_get("@content_for_layout")
        assigns['content_for_layout'] = content_for_layout
      end
      assigns.merge!(local_assigns.stringify_keys)
  
      liquid = Liquid::Template.parse(source)
      liquid.render(assigns, :filters =&gt; [@view.controller.master_helper_module], :registers =&gt; {:action_view =&gt; @view, :controller =&gt; @view.controller})
    end
  
    def compilable?
      false
    end
  
  end
  
  ::ActionView::Template.register_template_handler(:liquid, LiquidView)
  </code></pre>
  
  <p>Here is app/views/users/index.html.liquid</p>
  
  <pre><code>&lt;h1&gt;Listing users&lt;/h1&gt;
  
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Name&lt;/th&gt;
    &lt;/tr&gt;
  
    {% for user in @users %}
      &lt;tr&gt; &lt;td&gt; {{ user.name }} &lt;/td&gt; &lt;/tr&gt;
    {% endfor %}
  
  &lt;/table&gt;
  </code></pre>
  
  <p>And here is controller</p>
  
  <pre><code>class UsersController &lt; ApplicationController
    def index
      @users = User.all
      respond_to do |format|
        format.html # index.html.erb
      end
    end
  end
  </code></pre>
  
  <p>I am getting this error.</p>
  
  <pre><code>undefined method `template' for #&lt;UsersController:0x00000100979b80&gt;
  Extracted source (around line #1):
  
  1: &lt;h1&gt;Listing users&lt;/h1&gt;
  2: 
  3: &lt;table&gt;
  4:   &lt;tr&gt;
  </code></pre>