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
I am guessing this is required by ransack but it's a bit awkward and undocumented.
A better way would be to move this to a Service Class to remove this complexity from the controller. If this does not makes sense, minor improvements like this could help:
SearchTasks controller has create action which is using strong parameters(so it is absolute necessity)...For index action and search it might or might not be required depending on the situtation, we can also use ransackable attributes feature of ransack to allow ransack for only particular attributes. Altough i agree minor code refractoring can be done to make this action look more readable like using before_action :modify_params.
While
Api::V1::SearchTasksController
uses strong params:params.require(:search_task).permit(:name, :keywords_csv)
, the other APi controller does not.In addition the params naming is a kind of cryptic:
Instead, it could be named fully as
query
.In the params, this following is kind of hard to understand:
I am guessing this is required by
ransack
but it's a bit awkward and undocumented.A better way would be to move this to a Service Class to remove this complexity from the controller. If this does not makes sense, minor improvements like this could help:
The text was updated successfully, but these errors were encountered: