title: format.js is not manipulating dom once action caching enabled
body: <p><em>Note: I am presenting a logic here what I am doing.</em></p>
  <p><strong>What I am doing:</strong></p>
  <p>Think about the basic index action where we are listing products and with pagination. Now using remote-true option I have enabled ajax based pagination. So far things works perfectly fine. Take a look on sample code.</p>
  <p>Products Controller:</p>
  <pre><code> def index
    @products = Product.paginate(:order =&gt;&quot;name ASC&quot; ,:page =&gt; params[:page], :per_page =&gt; 14)
     respond_to do |format|
       format.html # index.html.erb
       format.json { render json: @products }
       format.js
     end
   end
  </code></pre>
  <p>Index.html.erb</p>
  <pre><code>&lt;h1&gt;Products&lt;/h1&gt;
  &lt;div id=&quot;products&quot;&gt;
      &lt;%= render &quot;products/products&quot; %&gt; // products partial is just basic html rendering
  &lt;/div&gt;
  
  &lt;script&gt;
  $(function(){
     $('.pagination a').attr('data-remote', 'true')
  });
  &lt;/script&gt;
  </code></pre>
  <p>Index.js.erb</p>
  <pre><code>  jQuery('#products').html(&quot;&lt;%= escape_javascript (render :partial =&gt; 'products/products' ) %&gt;&quot;);
    $('.pagination a').attr('data-remote', 'true');
  </code></pre>
  <p><strong>So whats the problem:</strong></p>
  <p>Now I want to enable action caching on this. But index.js.erb file is not manipulating DOM. If I remove the remote-true functionality then things works fine with caching.</p>
  <p>For action caching I have added this line on the top of the controller:</p>
  <pre><code> caches_action :index, :cache_path =&gt; Proc.new { |c| c.params }
  </code></pre>
  <p>Any suggestions?</p>
  <p><strong>Update:</strong></p>
  <p>Problem is jquery code is not executing. From <a href="https://stackoverflow.com/questions/5400083/jquery-script-request-not-caching">this</a> question</p>
  <p><em>I found out what's wrong. jQuery actually surround the incoming script with a so that the browser evaluates the incoming code. But the caching mechansim merely saves the code as text and when one re-request, it returns the code as text but not evaluate it. Therefore, one needs to eval the code explicitly</em></p>
  <p><strong>But how to solve this problem??</strong></p>