will_page无法按预期运行。问题是,当我单击下一个按钮或特定页面时,浏览器无法在任何位置导航。
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
willpaginate创建了正确数量的页面,但它不会在任何地方导航。我在想涡轮连杆可能在4号轨道上把它弄坏了。但任何想法都将受到赞赏。