Project

General

Profile

Bug #12109

rails 4 compatibility - user_role validation fix

Added by Tom Caspy almost 4 years ago. Updated about 1 year ago.

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

Associated revisions

Revision 01f0b231 (diff)
Added by Tom Caspy almost 4 years ago

fixes #12109 - removing owner_id presence validation

in rails 4, owner is not populated when creating a join model
(user.roles << role created a UserRole on the background)
in rails 3, this is not a problem, in rails 4, the presence validation
fails because no owner_id exists nor does an owner exist. at that
moment, there’s no need to do the uniqueness validation, as it’s the
user’s first roles. thus, this fix.

History

#1 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2801 added
  • Pull request deleted ()

#2 Updated by Daniel Lobato Garcia almost 4 years ago

Description from the PR


in rails 4, owner is not populated when creating a join model
(user.roles << role created a UserRole on the background)
in rails 3, this is not a problem, in rails 4, the presence validation
fails because no owner_id exists nor does an owner exist. at that
moment, there’s no need to do the uniqueness validation, as it’s the
user’s first roles. thus, this fix.

#3 Updated by Dominic Cleal almost 4 years ago

  • Category set to Rails
  • Assignee set to Tom Caspy
  • Legacy Backlogs Release (now unused) set to 71

#4 Updated by Tom Caspy almost 4 years ago

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

Also available in: Atom PDF