internetee-registry/app/models/epp_session.rb
Artur Beljajev fa52001be6 Upgrade to Rails 5.0
Closes #377
2019-11-15 15:26:33 +02:00

14 lines
365 B
Ruby

class EppSession < ApplicationRecord
belongs_to :user, required: true
validates :session_id, uniqueness: true, presence: true
def self.limit_per_registrar
4
end
def self.limit_reached?(registrar)
count = where(user_id: registrar.api_users.ids).where('updated_at >= ?', Time.zone.now - 1.second).count
count >= limit_per_registrar
end
end