Unpermitted parameter: page

David White david.white at trustpower.co.nz
Sun Sep 3 22:57:26 EDT 2017


Hi there,
      Noticed I kept getting Unpermitted parameter in the logs whenever I change page. 

Sep  4 14:23:19 acstest bash: Started GET "/devices?page=2" for ::1 at 2017-09-04 14:23:19 +1200
Sep  4 14:23:19 acstest bash: Processing by DevicesController#index as HTML
Sep  4 14:23:19 acstest bash: Parameters: {"page"=>"2"}
Sep  4 14:23:19 acstest bash: Rendering devices/index.html.erb within layouts/application
Sep  4 14:23:19 acstest bash: Unpermitted parameter: page
Sep  4 14:23:19 acstest bash: Unpermitted parameter: page
Sep  4 14:23:19 acstest bash: Unpermitted parameter: page
Sep  4 14:23:19 acstest bash: Unpermitted parameter: page
Sep  4 14:23:19 acstest bash: Rendered application/_pagination.html.erb (6.5ms)
Sep  4 14:23:19 acstest bash: Unpermitted parameter: page
Sep  4 14:23:19 acstest bash: Rendered devices/index.html.erb within layouts/application (78.9ms)
Sep  4 14:23:19 acstest bash: Rendered layouts/_menu.html.erb (2.2ms)
Sep  4 14:23:19 acstest bash: Completed 200 OK in 148ms (Views: 126.0ms | ActiveRecord: 0.0ms)

I believe the below lines should permit :page as well? I have tested it and it gets rid of it out of the log. Not sure if this is the best way to do it though.

/home/genieacs/app/views/devices/index.html.erb

<%= link_to 'Download', params.permit(:query, :sort).merge(:format => :csv) %>

/home/genieacs/app/views/application/_pagination.html.erb

<%= link_to '← Previous'.html_safe, params.permit(:query, :sort).merge(page: current_page - 1) %>
<%= link_to i, params.permit(:query, :sort).merge(page: i) %>
<%= link_to 'Next →'.html_safe, params.permit(:query, :sort).merge(page: current_page + 1) %>

Thanks,

David.
------------------------------------------------------------------------------------
The contents of this email and any attachments are confidential and may be privileged.  If you are not the intended recipient, you may not use, copy or disclose this email or its attachments.  Please notify the sender immediately by e-mail if you have received this e-mail in error and delete both emails from your system.  It is your responsibility to check this email and any attachments for viruses or other harmful code before opening or sending on.  Trustpower Limited and its subsidiaries (collectively, Trustpower) accepts no responsibility for any such virus or any effects of a virus on your systems or data.  Trustpower does not endorse anything in this email that is not related to its official business.

Please think of the environment before printing this email.

------------------------------------------------------------------------------------


More information about the Users mailing list