-
Notifications
You must be signed in to change notification settings - Fork 1
Fix to users soft_delete #329
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
base: main
Are you sure you want to change the base?
Conversation
danielnottingham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the context: "duplicate validations that ignored soft_delete"
-
The implementation completely removes unique email validation.
Problem: If the goal is to make validations consider soft delete, you shouldn't remove the validation, but adjust it. -
Why remove unique email validation?
validates :email, uniqueness: { case_sensitive: false }
Reported problem: Validations ignored soft delete.
3. Why not add better validation for this case? conditions: -> { where(deleted_at: nil) }
- I don't understand this migration to remove the index and then add another.
- Remove unique email index
- Recreate the same unique index
- Is this method really necessary? destroy_fully
| has_many :health_insurances, dependent: :destroy | ||
|
|
||
| validates :email, uniqueness: { case_sensitive: false } | ||
| def destroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do this at controller level, not at model level.
We only need to update to use realy_destroy here https://github.com/espoo-dev/med_system_backend/blob/main/app/controllers/api/v1/users_controller.rb#L14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to olhando aqui e o serviceo ja usa o destroy_fully!, agora eh esperar o Roanderson falar o que aconteceu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Context
Solution
Fix #327