mirror of
https://github.com/we-promise/sure
synced 2026-04-25 17:15:07 +02:00
- Added server-side validation to Category model to enforce 6-digit hex format for colors. - Added HTML pattern attribute to category form for client-side validation. - Updated tests to cover validation and fixed existing tests using shorthand hex colors.
This commit is contained in:
@@ -9,6 +9,7 @@ class Category < ApplicationRecord
|
||||
belongs_to :parent, class_name: "Category", optional: true
|
||||
|
||||
validates :name, :color, :lucide_icon, :family, presence: true
|
||||
validates :color, format: { with: /\A#[0-9A-Fa-f]{6}\z/ }
|
||||
validates :name, uniqueness: { scope: :family_id }
|
||||
|
||||
validate :category_level_limit
|
||||
|
||||
Reference in New Issue
Block a user