Bug #17457

multiple_checkboxes doesn't work with orgs/locs

Added by Daniel Lobato Garcia 10 months ago. Updated 9 months ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:Organizations and Locations
Target version:Team Daniel - iteration 8
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4039
Story points-
Velocity based estimate-
Release1.14.0Release relationshipAuto

Description

multiple_checkboxes calls ActiveModel::Naming on associations that could be simply "Taxonomy". This results on a 500 error 'undefined method `taxonomies' for #<Filter:0x005593624bdd18>' (or whatever other class has the problem). Simply trying to edit a filter will throw this 500 error.

https://github.com/theforeman/foreman/blob/develop/app/helpers/form_helper.rb#L49

We've always had this problem , but since #16971 removed the check for only using that method for '> 5' associations, you'd only see the error if you had at least 6 organizations or locations (unlikely). Now it became more apparent and it shows up every time.

Associated revisions

Revision 46ab6100
Added by Daniel Lobato Garcia 9 months ago

Fixes #17457 - multiple_checkboxes doesn't work with orgs/locs

multiple_checkboxes calls ActiveModel::Naming on associations that could
be simply "Taxonomy". This results on a 500 error 'undefined method
`taxonomies' for #<Filter:0x005593624bdd18>' (or whatever other class
has the problem). Simply trying to edit a filter will throw this 500
error.

We've always had this problem , but since #16971 removed the check for
only using that method for '> 5' associations, you'd only see the error
if you had at least 6 organizations or locations (unlikely). Now it
became more apparent and it shows up every time.

The fix I've used is just to take advantage of the options hash to send
the association name directly, and if it's not set, then use
ActiveModel::Naming to get it (as usual).

History

#1 Updated by The Foreman Bot 10 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4039 added

#2 Updated by Daniel Lobato Garcia 10 months ago

  • Target version set to Team Daniel - iteration 6

#3 Updated by Daniel Lobato Garcia 9 months ago

  • Target version changed from Team Daniel - iteration 6 to Team Daniel - iteration 8

#4 Updated by Anonymous 9 months ago

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

#5 Updated by Dominic Cleal 9 months ago

  • Release set to 1.14.0

Also available in: Atom PDF