Fix duplicate invites #1437
Reference in New Issue
Block a user
Delete Branch "fix-1436"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix #1436
This pull request introduces a new validation to ensure that an email can only be invited once per family and adds a unique index to enforce this constraint at the database level. The most important changes include updating the
Invitationmodel and modifying the database schema to include the new unique index.Model validation updates:
app/models/invitation.rb: Added a validation to ensure the uniqueness of theemailwithin the scope offamily_id.Database schema updates:
db/migrate/20241108150422_add_unique_email_index_to_invitations.rb: Created a migration to add a unique index on theemailandfamily_idcolumns in theinvitationstable.db/schema.rb: Updated the schema to reflect the new unique index on theemailandfamily_idcolumns in theinvitationstable. [1] [2]Thanks @tonyvince!