Skip to content

Fix Content model social_media_provider validation#17

Merged
springwq merged 1 commit intomainfrom
fix/content-validation
Mar 4, 2026
Merged

Fix Content model social_media_provider validation#17
springwq merged 1 commit intomainfrom
fix/content-validation

Conversation

@springwq
Copy link
Owner

@springwq springwq commented Mar 4, 2026

Changes

  • Removed contradictory allow_blank: true from social_media_provider validation
  • Consolidated two validation rules into one for better clarity

Problem

The Content model had conflicting validation rules:

  • Line 11: validates :social_media_provider, presence: true (required)
  • Line 12: validates :social_media_provider, inclusion: { in: social_media_providers.keys }, allow_blank: true (allows blank)

The allow_blank: true option contradicted the business requirement that social_media_provider is a required field.

Solution

Merged the two validations into a single rule:

validates :social_media_provider, presence: true, inclusion: { in: social_media_providers.keys }

This ensures the field is both required and restricted to valid enum values (instagram, tiktok, youtube).

Remove contradictory allow_blank: true from social_media_provider
validation. The field is required per business requirements, so the
presence validation should not be undermined by allow_blank.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@springwq springwq merged commit 61d4732 into main Mar 4, 2026
4 checks passed
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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