remove friendly_id <5.0 workarounds
With Rails 5.2:
- message: 'Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "CASE WHEN \"hostgroups\".\"title\" = ''928644347'' THEN 1 ELSE 0 END". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql().' callstack: app/controllers/api/base_controller.rb:407:in `prioritize_friendly_name_records'
app/controllers/api/base_controller.rb:378 says: "#Should be replaced after moving to friendly_id version >= 5.0"
This should be re-done now in a Rails 5.2 friendlier way.
Fixes #23234 - Simplify parent scope lookup
Knowing the id format allows us to know which field we should search by,
no need to try both id and friendly_id and use conditional order to
pick the friendly id first.