title: jQuery.pageless in Rails 3 with demo application
body: <p>I am trying to integrate jQuery.pageless plugin in my application, but in vain. Can anyone provide me with some resource that shows a Rails 3 demo application that has jQuery.pageless working?</p>
  
  <p>I tried looking into the example application that is provided with the plugin, which is in Rails 2.2. I tried to implement everything in a similar manner, but I get the error undefined method <strong>'total_pages' for Array &lt;....></strong>, which is the array of one of my models.</p>
  
  <p>Here's the code snippets:</p>
  
  <pre><code>module ApplicationHelper
    def pageless(total_pages, url=nil, container=nil)
      opts = {
        :totalPages =&gt; total_pages,
        :url        =&gt; url,
        :loaderMsg  =&gt; 'Loading more results'
      }
  
      container &amp;&amp; opts[:container] ||= container
  
      javascript_tag("$('#results').pageless(#{opts.to_json});")
    end
  end
  </code></pre>
  
  <h1>controller</h1>
  
  <pre><code>def index
    @posts = Post.all
  
    if request.xhr?
      sleep(3) # make request a little bit slower to see loader :-)
      render :partial =&gt; "shared/post", :collection =&gt; @posts
    end
  end
  </code></pre>
  
  <h1>view</h1>
  
  <pre><code>&lt;div id="recent-sale-item-area"&gt;
    &lt;% if !@posts.nil? %&gt;
      &lt;p id="recent-posts"&gt; recent posts &lt;/p&gt;
      &lt;div id="recent-sale-item-list"&gt;
        &lt;%= render :partial =&gt; "shared/post", :collection =&gt; @posts %&gt;
      &lt;/div&gt;
      &lt;%= will_paginate(@posts) %&gt;
       &lt;%= pageless(@posts.total_pages, posts_path) %&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>