Sha256: 9af6d441ed17d6e4bed4b926acac4a6fce56ab918117a987b709aa133edbbe09

Contents?: true

Size: 348 Bytes

Versions: 12

Compression:

Stored size: 348 Bytes

Contents

require_relative 'methods'

class Team < ActiveRecord::Base
  include Methods

  def self.purge!
    # destroy teams inactive for two weeks
    Team.where(active: false).where('updated_at <= ?', 2.weeks.ago).each do |team|
      puts "Destroying #{team}, inactive since #{team.updated_at}, over two weeks ago."
      team.destroy
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
slack-ruby-bot-server-0.12.0 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.11.1 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.11.0 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.10.0 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.9.0 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.8.3 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.8.2 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.8.1 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.8.0 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.7.0 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.6.1 lib/slack-ruby-bot-server/models/team/activerecord.rb
slack-ruby-bot-server-0.6.0 lib/slack-ruby-bot-server/models/team/activerecord.rb