Sha256: 12193657aadb1980b80813af1ba18643ec5ab2be59fca531b84b584fa185f2f7

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

module Yodeler
  class Event < ActiveRecord::Base
    serialize :payload, Hash
    
    validates_presence_of :event_type
    
    belongs_to :event_type, class_name: "Yodeler::EventType::Base", foreign_key: :yodeler_event_type_id
    has_many :notifications, class_name: "Yodeler::Notification", foreign_key: :yodeler_event_id

    delegate :subscriptions, to: :event_type
    delegate :name, to: :event_type

    def duration
      finished_at - started_at if finished_at.present? && started_at.present?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yodeler-0.0.10 lib/yodeler/models/event.rb