I am following this tutorial:
https://github.com/amatsuda/kaminari/wiki/How-To:-Create-Infinite-Scrolling-with-jQuery
So far everything works great, but I am stuck at the last part of the tutorial.
The content in my show.html.haml gets rendered like this:
- @search_results.each do |search_result|
=render 'search_result', :search_result=>search_result
The problem is that I have no idea how to translate that to show.js.erb, currently I have (mimicked from the tutorial)
$(".offers").append("<%= escape_javascript(render(@search_results)) %>");
but that throws errors. (undefined method `model_name’ for Hash:Class)
in my controller, search results is defined as:
@search_results = Kaminari.paginate_array(all_search_results).page(params[:page]).per(6)
all_search_results is an array that gets filled with stuff from another model.
did the trick