will_paginate NoMethodError

时间:2012-04-17 13:24:27

标签: ruby-on-rails ruby will-paginate

为railstutorial编写sample_app并出现下一个错误。

我已将<%= will_paginate @microposts %>添加到用户个人资料视图,@microposts = @user.microposts.paginate(:page => params[:page])添加到UsersController

> NoMethodError (protected method `wp_parse_options' called for #<Class:0x007fde66015a80>):
  app/controllers/users_controller.rb:17:in `show'

问题出在哪里?

1 个答案:

答案 0 :(得分:4)

尝试gem 'will_paginate', '~> 3.0'并再次捆绑安装,重启服务器。为了它的地狱paginate(page: params[:page], per_page: 15)

给予paginate一些额外的参数