# frozen_string_literal: true # == Schema Information # # Table name: accounts # # id :uuid not null, primary key # created_at :datetime not null # updated_at :datetime not null # class Account < ApplicationRecord has_many :api_keys, inverse_of: :account, dependent: :delete_all def self.authenticate_by_api_key!(key) ApiKey.authenticate!(key).account || raise(ActiveRecord::NotFound) end end