我们正在从Rails 4.2.5升级到5.0.0.beta1
在测试时,我们希望看到像以前一样使用分页链接呈现的索引视图。 但是我们现在得到一个ArgumentError错误页面,例如:
ArgumentError in Transactions#index
/app/views/kaminari/_paginator.html.erb where line #10 raised:
<%= paginator.render do -%>
Generating an URL from non sanitized request parameters is insecure!
Application Trace | Framework Trace | Full Trace
app/views/kaminari/_paginator.html.erb:10:in block in _app_views_kaminari__paginator_html_erb___4026289994022119719_69904100316060' app/views/kaminari/_paginator.html.erb:9:in_app_views_kaminari__paginator_html_erb___4026289994022119719_69904100316060'
app/views/transactions/index.html.erb:2:in `_app_views_transactions_index_html_erb__422882858554400818_60602560'
引发了一个问题
进一步调查这里是新的Rails 5.0.0.beta1代码,现在抛出错误:
将此添加到config / application.rb&#39;修复&#39;它,但不是一个好主意:
config.action_controller.permit_all_parameters = true
相反,添加此功能并不能解决问题,不确定原因:
config.action_controller.always_permitted_parameters = [:current_page, :page, :total_pages, :per_page, :remote, :paginator]
答案 0 :(得分:23)
这似乎是在github主分支中修复的,所以现在在你的gem文件中指定:
gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master'