Bug #25976
closedbookmarks and autocompletion don't work for nested controller
Description
auto_complete_controller_name
helper is used to determine both which controller to use for the auto_completion, as well as a value for bookmarks.controller
attribute. In bookmarks, we test the controller to match the database table.
In #24040, the code send("#{auto_complete_controller_name}_path")
(https://github.com/iNecas/foreman/commit/184f8d5ce23cfe208a696535bcea346074d8600a#diff-120a1c3293b2d4c051433c4f2c8a7a3bL1) was replaced with url: "#{auto_complete_controller_name}/auto_complete_search"
, so we suddenly started to assume that auto_complete_controller_name
will automatically match the controller_path
, which is not the case with nested controller (that we have in foreman_tasks).
As a result, we've hit https://projects.theforeman.org/issues/25427 and https://projects.theforeman.org/issues/25958/.
I think the solution should be to get the auto_complete_controller_name
the meaning it had before #24040, so not assuming path where we expect the controller name, and use the Rails path helpers to determine the right url. This way, we can also check better that the autocomplete url is actually defined.