Sha256: ca073a3db6a24c2cf4b356b8eb4353f92854b8cef40e834acc6297a346476623

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

require 'active_support/time'

Sequel::Model.plugin :timestamps, update_on_create: true

require 'clockwork_database_events/models/clockwork_database_event'
require 'clockwork_database_events/models/frequency_period'

# clockwork database events
module ClockworkDatabaseEvents
  def seed
    puts 'seeding frequecy table...'
    %w(second minute hour day week month).each do |period|
      FrequencyPeriod.find_or_create(name: period) do
        puts "created #{persiod}"
      end
    end
  end

  module_function :seed

  def db=(database)
    FrequencyPeriod.db = database
    ClockworkDatabaseEvent.db = database
  end

  module_function :db=
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clockwork_database_events-0.2.4 lib/clockwork_database_events/models.rb