Class: Hunter2::Model::Password

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/hunter2/model/password.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_or_update(params) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/hunter2/model/password.rb', line 6

def self.create_or_update(params)
  row = Password[params]

  if row.nil?
    return create(params)
  else
    return row.update(params)
  end
end

Instance Method Details

#validateObject



16
17
18
# File 'lib/hunter2/model/password.rb', line 16

def validate
  validates_unique(:key)
end