Sha256: 028f629a6732a44352398da7ac10b5a47fbeb1786be503d66d1ddc1d883ef4cb

Contents?: true

Size: 524 Bytes

Versions: 8

Compression:

Stored size: 524 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? and started_at.present?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
yodeler-0.0.9 lib/yodeler/models/event.rb
yodeler-0.0.8 lib/yodeler/models/event.rb
yodeler-0.0.7 lib/yodeler/models/event.rb
yodeler-0.0.6 lib/yodeler/models/event.rb
yodeler-0.0.5 lib/yodeler/models/event.rb
yodeler-0.0.4 lib/yodeler/models/event.rb
yodeler-0.0.3 lib/yodeler/models/event.rb
yodeler-0.0.1 lib/yodeler/models/event.rb