title: Rails 3, Haml, Javascript - how to put javascript's variable into a partial
body: <p>I have image upload, where I check, how big part of image is already uploaded - I do it this way:</p>
  
  <pre><code>jQuery - displaying progress bar
  ---
     uploader.bind('FilesAdded', function(up, files) {    
        $.each(files, function(i, file) {
          $('#filelist').append('#{escape_javascript(render(:partial =&gt; "form", :locals =&gt; {:file_id =&gt; file.id}))}');
        });
  
        up.refresh();
        uploader.start();
      });
  
      uploader.bind('UploadProgress', function(up, file) {  
        $('#'+file.id).find('strong').html('&lt;span&gt;' + file.percent + "%&lt;/span&gt;");
        $('#'+file.id).find('.bar').css('width',file.percent+"%");
      });
  
  
  form.html.haml
  ---
  #form_data
    %div{:id =&gt; file_id, :style =&gt; "width:330px;"}
    ...
  </code></pre>
  
  <p>And I am getting the error </p>
  
  <pre><code>undefined local variable or method `file' for #&lt;#&lt;Class:0x0000010161c0b8&gt;:0x0000012a3b1f20&gt;
  </code></pre>
  
  <p>Originally, I had the project in the ERB and on the place, where is now rendering of the partial  file was the content of this file - but now I converted the project to HAML and the code for displaying "progress bar" moved the code to the partial file, but now I am getting this error...</p>
  
  <p>Could anyone help me, please, how to fix this problem? Thank you</p>