title: What's the simplest way to use mustache view templates in rails?
body: <p>I could do:</p>
  
  <pre><code>render :text =&gt; Mustache.render(view_template_in_a_string, object_hash)
  </code></pre>
  
  <p>in my controller, but it seems more conventional to put view_template_in_a_string in it's own viewname.mustache.html file under views/controllername/action.mustache.html like I would with action.html.erb</p>
  
  <p>currently I use</p>
  
  <pre><code>gem 'mustache'
  </code></pre>
  
  <p>for my mustache needs</p>
  
  <p>How can I use mustache views like I would with erb</p>
  
  <hr>
  
  <p>I understand that mustache is logic-less, I don't need logic in my views</p>
  
  <hr>
  
  <p>my current hack:</p>
  
  <pre><code># controllers/thing_controller.rb
  def some_action
      hash = {:name =&gt; 'a name!!'}
      vw = File.read('./app/views/'+params[:controller]+'/'+params[:action]+'.html.mustache') || ""
      render :text =&gt; Mustache.render(vw, hash), :layout =&gt; true
  end
  </code></pre>