I'm having troubles paginating using Ajax. My View code looks for pagination looks like
= paginate @products, :remote => true
However, the AJAX call fails with error status code and Web Inspector shows it as seen below
The server logs show
ERROR Errno::ECONNRESET: Connection reset by peer
/Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
/Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
/Users/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
What is interesting though is if I add a hyperlink to the same page like
= link_to('Test', products_path(:page => 2), :remote => true)
The link look exactly like the one generated by Kaminari and the Ajax call succeeds without any issues whatsoever. More interesting, if I change generated pagination link from
<a href="/brands/deborah-lippmann" data-remote="true" rel="prev">1</a>
to
<a href="/brands/deborah-lippmann" data-remote="true">1</a>
which has nothing to do with AJAX, the link works fine again.
Is it something to do with jquery-ujs magic happening before links are rendered by Kaminari which uses ActionView Extensions and ActionView Context to generate tags for pagination links? Any help on this issue is greatly appreciated!