Похожее есть
тут# posts_controller.rb
class PostsController < ApplicationController
def index
@posts = Post.paginate(page: params[:page], per_page: 3)
respond_to do |format|
format.html
format.js
end
end
end
# index.html
<div class="page-header">
<h1>My posts</h1>
</div>
<div id="my-posts">
<%= render @posts %>
</div>
<div id="more_posts">
<%= link_to "More posts...", posts_index_url(page: @posts.next_page), remote: true %>
</div>
# index.js.erb
$("#my-posts").append('<%= escape_javascript render(@posts)%>');
$("#more_posts").html('<%= escape_javascript(link_to("More posts...", posts_index_url(page: @posts.next_page), remote: true)) if @posts.next_page %>');
# _post.html.erb
<div>
<h2><%= post.title %></h2>
<small><em><%= post.created_at %></em></small>
<p><%= truncate(strip_tags(post.body), length: 600) %></p>
</div>