Taxonomy search should search with STI base class
When searching with taxonomy scope, We are looking by model name. This may cause no results if the model is an STI child as the inner_select method adds the model.name (ArfReport) and not the base class name ("Report", which is what is saved in the taxable_taxonomies).
A possible solution: condition should change to self.base_class.name
If it is an STI it will call the parent name. If not an STI, it will call itself (current behavior).
#1 Updated by Marek Hulán over 4 years ago
- Tracker changed from Refactor to Bug
- Status changed from New to Assigned
- Assignee set to Marek Hulán
This was found in foreman_openscap plugin to get an idea you could imagine the issue with core models like this
User.current = User.first Organization.current = Organization.first Location.current = Location.first # loads all libvirts associated with first org and loc # through TaxableTaxonomy which has column taxable_type that # specifies object class - Foreman::Model::Libvirt in this case Foreman::Model::Libvirt.all
supposing you have some libvirt associated to selected orgs and locs you'll still see  as result since it uses Foreman::Model::Libvirt for taxable_type column in SQL query. Well, in this case it actually works because Taxonomix is included in ComputeResource directly so the same name is stored in taxable_type but if you think about model that is inherited in a plugin and adds taxonomies, it does not work.