I want to implement Ajax on my ruby on rails project. I currently use the will_paginate gem. Whenever I click for the next page, the whole page reloads, which I don't want to happen. How can I prevent this? I found a similar question but it didn't work for me. I guess it's because I am using Rails 5.2.2? I am not sure.
My index.html.erb looks like this:
<div class="row justify-content-center align-items-center">
<div class="page_info">
<h5><%= page_entries_info @imports %></h5>
</div>
</div>
<div class="row justify-content-center align-items-center">
<div class="page_info">
<h5><%= will_paginate @imports, :container => false %></h5>
</div>
</div>
Here is my code in my controller.rb:
class ImportsController < ApplicationController
def index
@imports = Import.all
@imports = Import.paginate(:page => params[:page], :per_page => 5)
end