设置Alphabetical Pagination gem的页面大小

时间:2015-02-13 16:09:02

标签: ruby-on-rails ruby pagination

我想按字母顺序对帖子标题进行分组,类似于https://rubygems.org/gems

我使用的是Alphabetical Pagination宝石,效果很好,但是,当我试图为每个页面设置限制时,我被卡住了。



class PostsController < ApplicationController
  
def index

@posts, @alphaParams = Post.all.alpha_paginate(params[:letter], {:bootstrap3 =>"false", :numbers => "false", :paginate_all => "true"}){|post| post.title}

  end
end

  <div id="pagination_table">
  <%= alphabetical_paginate @alphaParams %>

  <% @posts.each do |post| %>
  <h2><%= post.title.titleize %></h2>
  <p>
  <%= post.body.capitalize %>
  </p>
  <div>
  <% end%>
&#13;
&#13;
&#13;

0 个答案:

没有答案