Skip to content

Conversation

@diti0-dot
Copy link
Contributor

What is the goal of this PR and why is this important?

Add case-insensitive uniqueness validation to Category, CategoryType, and Sector models to prevent duplicate data creation.

How did you approach the change?

Updated model validations from validates_presence_of :name, uniqueness: true to proper validates :name, presence: true, uniqueness: { case_sensitive: false }.

Anything else to add?

No

@maebeale
Copy link
Collaborator

@diti0-dot looks like the factories need to be updated to sequences or Faker data instead of hard-coded names?

@diti0-dot
Copy link
Contributor Author

@diti0-dot looks like the factories need to be updated to sequences or Faker data instead of hard-coded names?

@maebeale I’ve updated the factories and added sequences for CategoryType and Sector so that all names are now unique, which should prevent the previous test failures.

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.

Add case insensitive uniqueness to Category, CategoryType, and Sector

2 participants