Sha256: 371b82d14f62b3e7c5de14951cbbca2f0fec469e312beb1b749d30389a5f19a6
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
module Yodeler module EventType class Base < ActiveRecord::Base self.table_name= "yodeler_event_types" class Configuration include ActiveSupport::Configurable config_accessor(:states) do { unread: 0, read: 1 } end end def self.configuration @configuration ||= Configuration.new end validates_presence_of :name validates_uniqueness_of :name has_many :events, dependent: :destroy, class_name: "Yodeler::Event", foreign_key: :yodeler_event_type_id has_many :subscriptions, dependent: :destroy, class_name: "Yodeler::Subscription", foreign_key: :yodeler_event_type_id # Logs the occurrence of a {Yodeler::Event} and dispatches notifications # # @param [Hash] params additional params to log # @option params [String] :started_at Benchmark started at time # @option params [String] :finished_at Benchmark finished at time # # @param [Hash] payload Serialized hash, anything you want # # @return [~Yodeler::EventType::Base] the logged event def self.yodel!(params) current_event_type = self.first current_event = current_event_type.events.create(params) current_event_type.subscriptions.each do |subscriber| end current_event end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yodeler-0.0.3 | lib/yodeler/models/event_types/base.rb |
yodeler-0.0.1 | lib/yodeler/models/event_types/base.rb |