0
私は私のウェブサイト上で私のテーブルをソートするために使用する次のコードを持っています。それはRails 4.2
で働いていましたが、Rails 5.1.4
にアップグレードした後は失敗します。私はRails 5の変更点を読んでいるはずですが、私は変更のためにそれが壊れていることを理解していますが、私はまだこのメソッドを変更する方法を理解していないので、私を見せて説明する。ありがとう!Rails 5.1.4のParamsにどのように追加できますか?
def roster_sort_link(column, title = nil)
title ||= column.titleize
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
icon = sort_direction == "asc" ? "glyphicon glyphicon-chevron-up" : "glyphicon glyphicon-chevron-down"
icon = column == sort_column ? icon : ""
link_to "#{title} <span style='font-size: 10px;' class='#{icon}'></span>".html_safe, params.merge({column: column, direction: direction})
end
問題は、それが述べメソッドの最後の行に来る:
params.merge({column: column, direction: direction})
私は取得していますエラーは以下の通りです:
unable to convert unpermitted parameters to hash
https://stackoverflow.com/questions/18424671/what-is-params-requireperson-permitname-age-doing-in-rails -4 – anothermh