Class: Gemstash::DB::Authorization
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Gemstash::DB::Authorization
- Defined in:
- lib/gemstash/db/authorization.rb
Overview
Sequel model for authorizations table.
Class Method Summary collapse
Class Method Details
.insert_or_update(auth_key, permissions, name = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gemstash/db/authorization.rb', line 9 def self.insert_or_update(auth_key, , name = nil) db.transaction do record = self[auth_key: auth_key] if record record.update(permissions: , name: name) else create(auth_key: auth_key, permissions: , name: name) end end end |