Skip to content

Instantly share code, notes, and snippets.

@kawahiro311
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawahiro311/77ab2dfe016ef119743b to your computer and use it in GitHub Desktop.
Save kawahiro311/77ab2dfe016ef119743b to your computer and use it in GitHub Desktop.
RailsでKaminariを使ったTwitter風ページネーション
<% @hoges.each do |hoge| %>
<%= hoge %>
<% end %>
<div id="hoges">
<%= render 'hoges' %>
</div>
<%= link_to_next_page @hoges, 'もっと見る', remote: true, id: 'more_link' %>
$("<%= escape_javascript(render 'hoges', object: @hoges) %>").appendTo("#hoges").hide().fadeIn('slow');
$("#more_link").replaceWith("<%= escape_javascript(
link_to_next_page(@hoges, 'もっと見る', remote: true, id: 'more_link')
) %>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment