回答

11

<%= will_paginate @mylist, :renderer => BootstrapPagination::Rails %> 

請確保您有重新啓動服務器安裝寶石後。

+1

重新啓動服務器爲我做了。謝謝。 –

+0

它可以工作,如果您可以請將其標記爲已接受,它將會很好。 –

+0

這不適合我。它在本地工作,但在服務器上,我收到了同樣的錯誤。 – kibaekr

0

在我的Gemfile中,我在我的「資產」組中使用了will_paginate-bootstrap ...但它不僅僅是一組資產。該課程需要在生產環節中進行。將它從資產組中移出解決了這個問題。

-1

嘗試在Gemfile中爲 '0.0.10'

gem 'bootstrap-will_paginate', '0.0.10'

,並使用<%= will_paginate @ MYLIST%>

它幫助我

1
更新 '引導-will_paginate'

如果您在rails 4.0或更高版本上使用gem will_paginate-bootstrap,則必須在所有階段都有它。見Rails Upgrade Guide 3.2 to 4.0。在Rails 4.0之前,這很好,只有資產纔有。

這是正確的軌道3.x或更早版本:

gem 'will_paginate-bootstrap', group: :assets 

它必須是所有組(在軌道上4.0及更高版本)外:

gem 'will_paginate-bootstrap' 
0

剛開始使用will_paginate並創建你自己的渲染效果很好。

對於引導4,下面扔this codeconfig/initializers/will_paginate.rb

然後,代碼爲application_helper.rb

def will_paginate(collection_or_options = nil, options = {}) 
    if collection_or_options.is_a? Hash 
     options, collection_or_options = collection_or_options, nil 
    end 
    unless options[:renderer] 
     options = options.merge renderer: WillPaginate::ActionView::BootstrapLinkRenderer 
    end 
    super *[collection_or_options, options].compact 
    end 

最後,在像這樣的觀點稱:

nav aria-label="blah" 
    = will_paginate @items 
相關問題