因为我需要以这种方式完成分页标签:
<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)
那么,如何以正确的方式连接这些东西呢?