因为我需要以这种方式完成分页标记:
<ul>
<li>
<a>some page</a>
</li>
</ul>
我想将自定义渲染器添加到Merb应用。当我把代码
module SearchPagination
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
protected
def windowed_page_numbers
inner_window = @options[:inner_window].to_i
window_from = current_page
window_to = current_page + inner_window
# adjust upper limit if out of bounds
window_to = total_pages if window_to > total_pages
left = (window_from..window_to).to_a
left << :gap if total_pages > window_to
left
end
end
端
进入helpers / paginate_helper.rb,然后在视图中使用它:
<%= will_paginate @channels, :renderer => SearchPagination::LinkRenderer %>
我收到了下一个错误:
uninitialized constant Merb::InlineTemplates::SearchPagination - (NameError)
那么,如何以正确的方式连接这些东西?