diff options
author | Tomáš Kukrál <kukratom@fit.cvut.cz> | 2016-08-11 10:37:09 +0300 |
---|---|---|
committer | Tomáš Kukrál <tom@6shore.net> | 2017-01-09 14:16:36 +0300 |
commit | 7808c9cb50f9706cc2ff4f75abe9531ce683f50a (patch) | |
tree | 6aefede1e2d312dfb36802474abddce1d141789c /app/models | |
parent | 8ab94120ee0a87c7b1158ebafea101e3952ec758 (diff) |
validate length of label.title
+ add test for label.title length validation
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/label.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index 5c01c15e5af..5b6b9a7a736 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -26,6 +26,7 @@ class Label < ActiveRecord::Base # Don't allow ',' for label titles validates :title, presence: true, format: { with: /\A[^,]+\z/ } validates :title, uniqueness: { scope: [:group_id, :project_id] } + validates :title, length: { maximum: 255 } default_scope { order(title: :asc) } |