Skip to content

Conversation

@lucasleandro1
Copy link
Contributor

Context

  • duplicate validations that ignored soft_delete

Solution

  • validatable devise method overridden to consider soft_delete

Fix #327

Copy link
Collaborator

@danielnottingham danielnottingham left a 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"

  1. 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.

  2. 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) }

  1. I don't understand this migration to remove the index and then add another.
  • Remove unique email index
  • Recreate the same unique index
  1. Is this method really necessary? destroy_fully

has_many :health_insurances, dependent: :destroy

validates :email, uniqueness: { case_sensitive: false }
def destroy
Copy link
Member

@edimossilva edimossilva Sep 8, 2025

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

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

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.

Identify and fix errors on sessions and registration user

3 participants