You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
** Why are these changes being introduced:
* We are building links to the different result tabs in the _source_tabs
view partial via the params.permit() method, but that list is not
comprehensive of the params that the SearchController is then adding.
This mismatch between permitted and used params is generating messages
in the logs about unpermitted parameters (two of them for every page
load, one for each tab)
** Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/use-94
** How does this address that need:
* This adds the :tab and :booleanType values to the list of permitted
parameters for building those links, which results in those log messages
no longer being written.
** Document any side effects to this change:
There are a few different ways we might resolve this behavior - I've
chosen the simplest to adopt now, but it may not be the best option
long term. For example, if next week we expand the SearchController to
add another new parameter, that would need to be added to this partial
or we'll have another round of log messages.
Other options include:
- Explicitly building the links by including every relevant parameter,
i.e. results_path(q: params[:q], per_page: params[:per_page]... - this
would limit the need to keep this partial in sync with the controller.
- Choosing a different way of handling values like :booleanType that
does not rely on manipulating the params object in the midst of
responding to a page request. This is probably the cleanest option, but
means refactoring more of the application, and a larger level of effort.
Note that I originally tried to resolve this condition via a
before_action lifecycle hook in the SearchController, explicitly making
:tab and :booleanType params permitted. That doesn't work because the
partial also calls .permit, which acts independently of anything the
controller does or doesn't do.
0 commit comments