From 40ee546461fd9b67bfc4be1e96397afe96ca5a6d Mon Sep 17 00:00:00 2001 From: Monica Cellio <cellio@pobox.com> Date: Tue, 20 Sep 2022 19:28:23 -0400 Subject: [PATCH] Changed error messages to avoid 'tags can't have more than 5 tags' construct. I realize that usually we want to attach an error to the field (:tags) not the post (:base), but I couldn't come up with wordings that were clear and the error messages point to tags as the problem, so I think this is ok. --- app/models/post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index cac04dbc8..458b91df7 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -265,9 +265,9 @@ class Post < ApplicationRecord def maximum_tags if tags_cache.length > 5 - errors.add(:tags, "can't have more than 5 tags") + errors.add(:base, "Post can't have more than 5 tags.") elsif tags_cache.empty? - errors.add(:tags, 'must have at least one tag') + errors.add(:base, 'Post must have at least one tag.') end end -- GitLab