Bug #17457
multiple_checkboxes doesn't work with orgs/locs
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
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).
(cherry picked from commit 46ab6100609e769faeaca3a475b31445a8d72b3d)
History
#1
Updated by The Foreman Bot over 5 years ago
- Status changed from New to Ready For Testing
- Assignee set to Daniel Lobato Garcia
- Pull request https://github.com/theforeman/foreman/pull/4039 added
#2
Updated by Daniel Lobato Garcia over 5 years ago
- Target version set to 1.4.3
#3
Updated by Daniel Lobato Garcia over 5 years ago
- Target version changed from 1.4.3 to 1.15.5
#4
Updated by Anonymous over 5 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 46ab6100609e769faeaca3a475b31445a8d72b3d.
#5
Updated by Dominic Cleal over 5 years ago
- Legacy Backlogs Release (now unused) set to 189
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).