Table: RailsNotes
User: dreamable
Created at: 2020-11-13 02:33:01 UTC
Updated at: 2020-11-13 02:33:38 UTC
Reference:(Table ID 3, Record ID 6)

标题 :
Link to current page with plus/merged with a param
笔记 :

Solution

link_to "Page", params.merge(:c => "e")

Error: Rails Unable to convert unpermitted parameters to hash

solution

#If you know which parameters should be allowed in the link, you can call permit with those listed.
params.permit(:param_1, :param_2).merge(:sort => column, :direction => direction, :page => nil)
# OR
params.merge(:sort => column, :direction => direction, :page => nil).permit(:param_1, :param_2, :sort, :direction, :page)
# Risk solution
params.to_unsafe_h.merge
Tag: