Actions
Bug #22043
closedUnable to create location with organization_ids: [1] - Organizations is invalid
Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Description
During creation of a location, if it is assigned organizations which are invalid the creation fails as the location attempts to validate the associated organization. (This also happens the other way around). This is due to has_and_belongs_to_many defaulting to validating the associated records as well.
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1514915
Description of problem:
- curl -sku admin:changeme -d '{"location": {"name": "foo6", "organization_ids": [1]}}' -H 'Content-Type: application/json' https://$(hostname)/api/v2/locations
{
"error": {"id":null,"errors":{"organizations":["is invalid"]},"full_messages":["Organizations is invalid"]}
}
- specifying other (existing) organization id(s) works as expected
Actual results:
Organizations is invalid
Expected results:
Location created and assigned to Default Organization
Updated by The Foreman Bot about 7 years ago
- Status changed from New to Ready For Testing
- Assignee set to Tomer Brisker
- Pull request https://github.com/theforeman/foreman/pull/5104 added
Updated by Marek Hulán about 7 years ago
- Subject changed from Unable to create location with organization_ids: [1] - Organizations is invalid to Unable to create location with organization_ids: [1] - Organizations is invalid
- Translation missing: en.field_release set to 296
Updated by Anonymous about 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset ad61b8ca8da979ce51d383495bbc8b966ef433e5.
Actions