Project

General

Profile

Bug #24046

Foreman's HasManyCommon concern uses 'id' for a method Rails expects to return a string

Added by Stephen Benjamin 3 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Category:
Rails
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Foreman HasManyCommon concern uses 'id' as a value of last resort for the name of an attribute. But Rails expects this value to a return a string. This causes a problem for Katello. Take a look at the output here in Katello:

irb(main):001:0> Host.first
Hirb Error: undefined method `gsub' for 2:Integer
</rep>

Where's that coming from?

<pre>
irb(main):006:0> Host.first.content_facet_attributes.to_s
=> 2
irb(main):007:0> Host.first.content_facet_attributes.to_s.is_a?(String)
=> false
</pre>

Foreman should use a method that returns string as a last resort.

Associated revisions

Revision ae96cb70 (diff)
Added by Stephen Benjamin 3 months ago

fixes #24046 - return id as str for name as last resort

Foreman HasManyCommon concern uses 'id' as a value of last resort for
the name of an attribute. But Rails expects this value to a return a
string. This causes a problem for Katello. Take a look at the output
here in Katello:

```
irb(main):001:0> Host.first
Hirb Error: undefined method `gsub' for 2:Integer
```

Where's that coming from?

```

irb(main):006:0> Host.first.content_facet_attributes.to_s
=> 2
irb(main):007:0> Host.first.content_facet_attributes.to_s.is_a?(String)
=> false

```

History

#1 Updated by The Foreman Bot 3 months ago

  • Assignee set to Stephen Benjamin
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5732 added

#2 Updated by Tomer Brisker 3 months ago

  • Legacy Backlogs Release (now unused) set to 353

#3 Updated by Stephen Benjamin 3 months ago

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

Also available in: Atom PDF