Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in cohorts controller that failed to update when a teacher email was missing #13424

Merged
merged 1 commit into from Feb 24, 2017

Conversation

aoby
Copy link
Contributor

@aoby aoby commented Feb 24, 2017

Error in the wild

ActiveRecord::AssociationTypeMismatch: User(#49552900) expected, got NilClass(#8696380)
  cohorts_controller.rb  132  update_teachers(...)

And sure enough, the unit test I just added failed with:

Minitest::UnexpectedError: ActiveRecord::AssociationTypeMismatch: User(#70110212537500) expected, got NilClass(#70110346146360)
    app/controllers/ops/cohorts_controller.rb:132:in `update_teachers'

The solution was straightforward. In update_teachers, the teachers param lists is mapped into User models representing the teachers, found or created on the fly, unless email is blank in which case that entry is nil. Then, later processing blew up on the nil User. Fix was simply compacting the user list to remove nils.

@aoby aoby merged commit b14a5e6 into staging Feb 24, 2017
@aoby aoby deleted the cohort-fix branch February 24, 2017 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants