theforeman/foreman — pull request #1641 by domcleal (2014-08-01 09:55:26+00:00)
Title: fixes #6873 - ensure hidden 'owner' is populated on user role

Also re-order seeding such that the anonymous role is added to seeded users.

---

I've filed http://projects.theforeman.org/issues/6878 to consider moving away from default scopes. Here the default (hidden) scope on User is causing a problem with the UserRole association, as owner_id is populated, but owner is nil.

If you do the 1.4 to 1.6 upgrade (see #1639 description) without the user.rb change but with the seed reorder, you'll see the error clearly, as the anonymous role will be present and get added to the hidden user.