simple refactoring
This commit is contained in:
parent
a635b9da97
commit
df7c52489a
21 changed files with 276 additions and 264 deletions
|
@ -6,16 +6,15 @@ class Key < ActiveRecord::Base
|
|||
|
||||
attr_accessible :key, :title
|
||||
|
||||
validates :title, presence: true, length: { within: 0..255 }
|
||||
validates :key, presence: true,
|
||||
length: { within: 0..5000 },
|
||||
format: { :with => /ssh-.{3} / }
|
||||
|
||||
before_save :set_identifier
|
||||
before_validation :strip_white_space
|
||||
delegate :name, :email, to: :user, prefix: true
|
||||
before_save :set_identifier
|
||||
|
||||
validates :title, presence: true, length: { within: 0..255 }
|
||||
validates :key, presence: true, length: { within: 0..5000 }, format: { :with => /ssh-.{3} / }
|
||||
validate :unique_key, :fingerprintable_key
|
||||
|
||||
delegate :name, :email, to: :user, prefix: true
|
||||
|
||||
def strip_white_space
|
||||
self.key = self.key.strip unless self.key.blank?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue