will_paginate不能按預期運行。問題是當我點擊下一個按鈕或特定頁面時,瀏覽器不能在任何地方導航。Rails 4 will_paginate;不更改頁面
class PagesController < ApplicationController
def index
# Shout Stuff
@link = Link.all.paginate(:page => 1, :per_page => 1)
end
end
這是視圖
<% @link.each do |link| %>
<li><%= link_to link.title, 'shouts/' + link.id.to_s %></li>
<% end %>
<%= will_paginate @link %>
最後的LinksController:
class LinksController < ApplicationController
def show
end
def new
@link = Link.new
end
def create
@link = Link.create(link_params)
end
private
def link_params
params.require(:link).permit(:title, :url)
end
end
will_paginate創建的頁面的正確數量,但它不會在任何地方瀏覽。我想也許turbolinks打破了它在軌道4,但任何想法,將不勝感激。
可能是值得一提的Ruby 2.1.0 Rails的4.1 – CodeHard
':頁面=> 1'應該是':page => params [:page]'。 – Pavan