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 #1

Updated by Dominic Cleal about 8 years ago

  • Related to Bug #16389: Can't create taxable e.g. domain object if I'm in context of specific organization or location added
Actions #2

Updated by Dominic Cleal about 8 years ago

  • Status changed from New to Assigned
  • Translation missing: en.field_release set to 181
Actions #3

Updated by Marek Hulán about 8 years ago

oh my... sorry

Actions #4

Updated by The Foreman Bot about 8 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3824 added
Actions #5

Updated by Marek Hulán about 8 years ago

  • Translation missing: en.field_release changed from 181 to 160

The introducing commit is not present in 1.12 so I think this should go to 1.13 where it's present. Feel free to reset if I'm mistaken.

Actions #6

Updated by Dominic Cleal about 8 years ago

The change introducing the bug is currently set for inclusion in 1.12.3, so just setting this the same. Should #16389 be changed?

Actions #7

Updated by Daniel Lobato Garcia about 8 years ago

At your will, both have to be introduced at the same time though. I'd prefer to introduce them both on 1.13 to play safe with 1.12.3

Actions #8

Updated by Dominic Cleal about 8 years ago

Yes, they need to be on the same release. I opted for the point release on the other because I felt it was a somewhat severe bug, though it has a reasonably easy workaround.

Actions #9

Updated by Marek Hulán about 8 years ago

  • Translation missing: en.field_release changed from 160 to 181

Ok, makes sense, moving this back to 1.12.3 because of severity. Sorry for the noise.

Actions #10

Updated by Daniel Lobato Garcia about 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF