Update spree_adjustments.finalized to be non null#973
Merged
gmacdougall merged 1 commit intoMar 8, 2016
Merged
Conversation
25ee7b9 to
0eed00b
Compare
When we migrated from state=open/closed to finalized=true/false in d33254d we added `finalized` as a nullable column. This breaks the scopes that we added in that commit -- when finalized is null the adjustments are neither `finalized` nor `not_finalized`. I noticed this while trying to add some code and specs using the `not_finalized` scope. We could try to tweak the scopes but I think it'd be better to just avoid the ternary logic altogether by disallowing nulls. In the old code we had `state_machine :state, initial: :open` which prevented this problem even though the `state` column itself was nullable.
0eed00b to
899e386
Compare
Contributor
|
Thanks Jordan, that makes sense 👍 |
Member
|
Death to tri-state booleans! 👍 |
gmacdougall
added a commit
that referenced
this pull request
Mar 8, 2016
…zed-nulls Update spree_adjustments.finalized to be non null
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When we migrated from state=open/closed to finalized=true/false in
#279 we added
finalizedas a nullable column. This breaks thescopes that we added in that commit -- when finalized is null the
adjustments are neither
finalizednornot_finalized.I noticed this while trying to add some code and specs using the
not_finalizedscope.We could try to tweak the scopes but I think it'd be better to just
avoid the ternary logic altogether by disallowing nulls.
In the old code we had
state_machine :state, initial: :openwhichprevented this problem even though the
statecolumn itself wasnullable.