Sha256: 9dcf3c7ea653a22fd1bd73724d02f3c38f6c03ef43c785970185bc2efec5bc8d
Contents?: true
Size: 992 Bytes
Versions: 1
Compression:
Stored size: 992 Bytes
Contents
module Unidom::Certificate::Concerns::AsCertificated extend ActiveSupport::Concern included do |includer| has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated def is_certificated!(certification, by: nil, at: Time.now) raise ArgumentError.new('The certification argument is required.') if certification.blank? raise ArgumentError.new('The by argument is required.' ) if by.blank? raise ArgumentError.new('The at argument is required.' ) if at.blank? certificatings.create! certification: certification, certificator: by, opened_at: at end def is_certificated?(certification, at: Time.now) raise ArgumentError.new('The certification argument is required.') if certification.blank? raise ArgumentError.new('The at argument is required.' ) if at.blank? certificatings.certification_is(certification).valid_at(now: at).alive.exists? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-certificate-1.3 | app/models/unidom/certificate/concerns/as_certificated.rb |