- class Assignment
- def transfer(person_id: nil)
- random = false
- if !person_id
- person_id = get_random_person.id
- random = true
- end
- @thing.update(assignee: person_id)
- rescue NotFound
- transfer(get_random_person(refresh: true).id)
- end
- private
- def get_random_person(refresh: false)
- @person = nil if refresh
- @person ||= begin
- RandomPerson.new
- end
- end
- end