Rails: Autoloading lib not working

时光总嘲笑我的痴心妄想 提交于 2019-12-04 16:16:21

In your config/initializers folder make a file called pagination.rb and include the following. Restart and it should work.

module WillPaginate::ViewHelpers
    # default options that can be overridden on the global level
    @@pagination_options = {
      :class        => 'pagination',
      :previous_label   => '« Previous',
      :next_label   => 'Next »',
      :inner_window => 2, # links around the current page
      :outer_window => -1, # links around beginning and end
      :limit        => 5,
      :separator    => ' ', # single space is friendly to spiders and non-graphic browsers
      :param_name   => :page,
      :params       => nil,
      :gap          => "...",
      :renderer     => '::PaginationListLinkRenderer',
      :page_links   => true,
      :container    => true
    }
    mattr_reader :pagination_options
end

Change you Lib pagination File to...

pagination_list_link_renderer.rb

Make sure you have the latest version of Will_Pagination. Version 3 Pre

Just change:

lib\paginationlistlinkrenderer.rb code

class PaginationListLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer

    protected
    ...
    ...

end

To

class PaginationListLinkRenderer < WillPaginate::ActionView::LinkRenderer

    protected
    ...
    ...

end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!