Take the 2-minute tour ×

I updated my Rails 3.0.7 application to use kaminari 0.12.4 (up from 0.10.4) for pagination and jquery-rails 1.0.9 and it seemed to break pagination. I've regenerated the kaminari views since they are different but for some reason ajax isn't working.

<%= javascript_include_tag :defaults %>

is included. Which produces this in the browser:

<script src="/javascripts/jquery.js?1306353646" type="text/javascript"></script> 
<script src="/javascripts/jquery-ui.js?1306368501" type="text/javascript"></script> 
<script src="/javascripts/jquery_ujs.js?1306381513" type="text/javascript"></script> 
<script src="/javascripts/application.js?1290034766" type="text/javascript"></script>

In my view I have: <%= paginate @users, :remote => true %>

Which yields the following error:

ActionView::MissingTemplate (Missing template users/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:js, "application/ecmascript", "application/x-ecmascript", "/"], :locale=>[:en, :en]} in view paths "/home/epipheus/CodeWarehouse/praypeer/app/views", "/home/epipheus/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/kaminari-0.12.4/app/views"):

the following non-ajax version works just fine of course:

<%= paginate @users, :remote => false %>

So it seems like I have something wrong with jquery ujs? Please help me.

share|improve this question
Seems with jquery you need to add index.js.html like this: $('#users').html('<%= escape_javascript render(@users) %>'); $('.app-table-pager').html('<%= escape_javascript(paginate(@users, :remote => true).to_s) %>'); –  Michael K Madison Jul 17 '11 at 9:08
add comment

2 Answers

I recently had problems with jquery-rails after update. I updated the gem via bundler, but it was not quite compatible with an existing jquery-rails files. After I ran "rails generate jquery:install" command, I did not see any more errors.

share|improve this answer
I even removed all javascript files and did a rails g jquery:install --ui –  Michael K Madison May 26 '11 at 18:39
where is the jquery config? –  Michael K Madison May 26 '11 at 18:41
Oh, sorry, this was not a config but a set of js files. If jquery:install did not help, let's see if someone else can give an advice. –  Kira Corina May 27 '11 at 9:48
anyone else have any advice? –  Michael K Madison Jun 1 '11 at 23:17
add comment
up vote 0 down vote accepted

Turns out that for jquery kaminari needs you to insert the following to say show.js.erb for example:

$('#microposts').html('<%= escape_javascript render(@microposts) %>');
$('.app-table-pager').html('<%= escape_javascript(paginate(@microposts, :remote => true).to_s) %>');

If you don't switch to jquery-rails/ujs -- out of the box, it doesn't seem you need this.

share|improve this answer
add comment

Your Answer


