Skip to content

Conversation

@ysbaddaden
Copy link
Contributor

closes #1910
closes #1913

@ysbaddaden ysbaddaden self-assigned this Feb 9, 2023

validates_presence_of :purpose
validates_inclusion_of :purpose, in: ->(_) { Box.purposes }
validates_inclusion_of :purpose, in: ->(_) { Box.purposes }, allow_blank: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid a duplicate error message when the purpose is missing:

  • purpose can't be blank
  • purpose is not included in the list

Copy link
Contributor

@leandroradusky leandroradusky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@ysbaddaden ysbaddaden merged commit 9c6f8b5 into main Feb 9, 2023
@ysbaddaden ysbaddaden deleted the fix/1910-box-form-errors branch February 9, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can create box without selecting to create or select samples Server error when trying to create Box without a purpose

3 participants