Skip to content
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

Fix: Improved slug validation and error handling for courses #6089

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AliyanA1
Copy link

@AliyanA1 AliyanA1 commented Jan 4, 2025

#6087 This PR fixes an issue where updating a course slug to a duplicate value caused a generic "Internal Server Error." The changes include:

  1. Added Slug Validation in Course Model:

    • Ensures slug is unique with a clear error message:
      "Slug must be unique. Another course with this slug already exists."
  2. Improved Error Handling in update Method:

    • The courses_controller.rb now validates updates and provides meaningful error messages to users when a slug conflict occurs.
    • Returns a 422 Unprocessable Entity status with detailed validation messages.

@AliyanA1 AliyanA1 changed the title #6087 Fix: Improved slug validation and error handling for courses Fix: Improved slug validation and error handling for courses #6087 Jan 4, 2025
@AliyanA1 AliyanA1 changed the title Fix: Improved slug validation and error handling for courses #6087 Fix: Improved slug validation and error handling for courses Jan 5, 2025
@ragesoss
Copy link
Member

ragesoss commented Jan 6, 2025

Please add before/after screenshots demonstrating the change.

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.

2 participants