title: What's a good plugin or guide I can use to create javascript widgets from a Rails App?
body: <p>I've been looking around for a while now and the best guide I've seen so far is Dr Nic's DIY widgets how to <a href="http://drnicwilliams.com/2006/11/21/diy-widgets" rel="nofollow noreferrer">(here)</a>. </p>
  
  <p>I haven't been able to make something like this work:</p>
  
  <p>Assuming this is my widget code:</p>
  
  <pre><code>&lt;script src="http://mysite/nomnoms.js"&gt; &lt;/script&gt;
  </code></pre>
  
  <p>And my nomnoms controller looks like (assume that the list partial exists and simply lists down a link to the show page of each nomnom in the @nomnoms variable):</p>
  
  <pre><code>class NomnomsController &lt; ApplicationController
  
  def index
    @nomnoms = Nomnom.find(:all)
    @content = render_to_string(:partial =&gt; 'list')
  end
  
  end
  </code></pre>
  
  <p>And in the index.js of my nomnoms_controller I have:</p>
  
  <pre><code>page &lt;&lt; "document.write('&lt;div&gt;'"
  page &lt;&lt; "document.write('#{@content.to_json}')"
  page &lt;&lt; "&lt;/div&gt;"
  </code></pre>
  
  <p>The above setup doesn't render anything :(. But when I change the second line of index.js to:</p>
  
  <pre><code>page &lt;&lt; "document.write('nomnoms should be here')
  </code></pre>
  
  <p>...the widget renders the text. Any help or even a point in the right direction would be greatly appreciated. Thanks in advance. </p>