mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-21 10:17:48 +01:00
added maximum length for group name
This commit is contained in:
parent
e5b753681c
commit
3ba2b785d4
1 changed files with 4 additions and 1 deletions
|
@ -2,9 +2,12 @@ class Group < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
has_many :group_members, dependent: :destroy
|
||||
|
||||
validates :display_name, length: { maximum: 30 }
|
||||
|
||||
before_validation do
|
||||
self.display_name.strip!
|
||||
self.name = self.display_name.downcase.sub(/\s+/, '-')
|
||||
self.name = 'group-followers' if self.name == 'followers'
|
||||
self.name = '-followers-' if self.name == 'followers'
|
||||
end
|
||||
|
||||
alias members group_members
|
||||
|
|
Loading…
Reference in a new issue