Project

General

Profile

Actions

Bug #16463

closed

with_taxonomy_scope returns all objects when no taxable ids available

Added by Daniel Lobato Garcia about 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Currently scoping by taxonomies is broken.

Before this commit: https://github.com/theforeman/foreman/commit/35ed04f95f14c934ffebc874e90a3a4a6684fe71

`scope = scope.where(:id => taxable_ids) if taxable_ids`

did STILL call `scope.where(:id => [])` when taxable_ids were not found.
That returns an empty scope, and is the appropriate thing to do if there are no taxable IDs.
However after the commit, `if taxable_ids.present?` will make scope return `1=1` for the case where there are no taxable IDs.

If there are some taxable IDs, it does the right thing and scopes the object properly. That use case works fine.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #16389: Can't create taxable e.g. domain object if I'm in context of specific organization or locationClosedMarek Hulán08/31/2016Actions
Actions

Also available in: Atom PDF