title: if statement in js.erb file based on param_name will_paginate (Ajax call)
body: <p>I am trying to work out how to have multiple Ajax calls on the same page (same controller Action) using the will_paginate Gem. So far i have given each instance variable its own param_name so that they are not using the default param of :page</p>
  
  <p>Example Controller </p>
  
  <pre><code>@meats= Recipe.meat_recipes.paginate(:page =&gt; params[:meat_recipes], :per_page =&gt; 1)
  @vegrecipes = Recipe.veg_recipes.paginate(:page =&gt; params[:veg_recipes], :per_page =&gt; 1)
  @desserts = Recipe.dessert_recipes.paginate(:page =&gt; params[:dessert_recipes], :per_page =&gt; 1)
  </code></pre>
  
  <p>Then in the view</p>
  
  <pre><code> &lt;%= will_paginate @meats,  :param_name =&gt; 'meat_recipes'  %&gt; (repeat this for individual instance variables)
  </code></pre>
  
  <p>So this part is fine. What i am doing is loading a partial when the AJAX request is made like so</p>
  
  <p>.js.erb file</p>
  
  <pre><code>$('#meatRecipes').html('&lt;%= escape_javascript(render partial: 'meatrecipes') %&gt;');
  $.setAjaxPagination();
  </code></pre>
  
  <p>so at the moment my meat instance variable is working fine. So how to conduct an if statement based on params? </p>
  
  <p>I have tried this for example</p>
  
  <pre><code>&lt;% if @meats %&gt;
  $('#meatRecipes').html('&lt;%= escape_javascript(render partial: 'meatrecipes') %&gt;');
  $.setAjaxPagination();
  &lt;% end %&gt;
  
  &lt;% if @vegrecipes %&gt;
  $('#vegRecipes').html('&lt;%= escape_javascript(render partial: 'vegrecipes') %&gt;');
  $.setAjaxPagination();
  &lt;% end %&gt;
  </code></pre>
  
  <p>Also tried</p>
  
  <pre><code>&lt;% if @meats[:param_name] == 'meat_recipes' %&gt;
  $('#meatRecipes').html('&lt;%= escape_javascript(render partial: 'meatrecipes') %&gt;');
  $.setAjaxPagination();
  &lt;% end %&gt;
  
  &lt;% if @vegrecipes[:param_name == 'veg_recipes' %&gt;
  $('#vegRecipes').html('&lt;%= escape_javascript(render partial: 'vegrecipes') %&gt;');
  $.setAjaxPagination();
  &lt;% end %&gt;
  </code></pre>
  
  <p>but this doesn't work. So i guess my question is what do i use as my argument to ensure that the correct partial is being called for the particular pagination section.</p>
  
  <p>Hope I have explained this correctly</p>