title: rails 4.1 - rendering nested partial in JS template - local variable issue
body: <p>in my controller <strong>create</strong> action i have:</p>
  
  <pre><code>if @content.save
  respond_to do |format|
   @contents = Content.all
   format.html ...
   format.js
  end
  </code></pre>
  
  <p>in my view I have:</p>
  
  <pre><code>some html ...
  render partial("home/contents")
  </code></pre>
  
  <p>contents partial:</p>
  
  <pre><code>@contents.each do |c| 
      some html ... (image being rendered by amazon s3/cdn)
        &lt;%= render 'action_buttons', :c =&gt; c  %&gt;
      end
  </code></pre>
  
  <p>action_buttons partial:
  2 submit buttons (one for create, one for delete) </p>
  
  <p>This works fine when the page is loaded - however when I submit the create action in the action buttons partial, the js error: undefined local variable or method 'c'.  </p>
  
  <p>In my create.js.erb I have</p>
  
  <pre><code>$(".action_buttons").html("&lt;%= j render("home/action_buttons"), :c =&gt; c %&gt;")
  </code></pre>
  
  <p>so it looks like its trying to render the view correctly so the syntax is correct however the c variable is not rendering </p>
  
  <p>Keep in mind that I am only doing this because if render out the contents partial, it will re-render the image in that partial that is being served by s3, so the entire page has multiple images. To avoid this I would rather render on just the action buttons.</p>