Increase #cache_tag_list limit (#436)
* Update error message for single tag length * Increase cached_tag_list length to match tag length limit
This commit is contained in:
parent
8c695378c5
commit
79d8661ccc
2 changed files with 3 additions and 3 deletions
|
|
@ -31,7 +31,7 @@ class Article < ApplicationRecord
|
|||
validate :validate_tag
|
||||
validate :validate_video
|
||||
validates :video_state, inclusion: { in: %w(PROGRESSING COMPLETED) }, allow_nil: true
|
||||
validates :cached_tag_list, length: { maximum: 64 }
|
||||
validates :cached_tag_list, length: { maximum: 86 }
|
||||
validates :main_image, url: { allow_blank: true, schemes: ["https", "http"] }
|
||||
validates :main_image_background_hex_color, format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/
|
||||
validates :video, url: { allow_blank: true, schemes: ["https", "http"] }
|
||||
|
|
@ -414,7 +414,7 @@ class Article < ApplicationRecord
|
|||
return errors.add(:tag_list, "exceed the maximum of 4 tags") if tag_list.length > 4
|
||||
tag_list.each do |tag|
|
||||
if tag.length > 20
|
||||
errors.add(:tag, "\"#{tag}\" is too long (maximum is 16 characters)")
|
||||
errors.add(:tag, "\"#{tag}\" is too long (maximum is 20 characters)")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ RSpec.describe Article, type: :model do
|
|||
it { is_expected.to validate_uniqueness_of(:feed_source_url).allow_blank }
|
||||
it { is_expected.to validate_presence_of(:title) }
|
||||
it { is_expected.to validate_length_of(:title).is_at_most(128) }
|
||||
it { is_expected.to validate_length_of(:cached_tag_list).is_at_most(64) }
|
||||
it { is_expected.to validate_length_of(:cached_tag_list).is_at_most(86) }
|
||||
it { is_expected.to belong_to(:user) }
|
||||
it { is_expected.to belong_to(:organization) }
|
||||
it { is_expected.to belong_to(:collection) }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue