Class: AssociatedGroup

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/associated_group.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cleanup!Object



16
17
18
19
20
21
22
# File 'app/models/associated_group.rb', line 16

def self.cleanup!
  AssociatedGroup
    .left_joins(:group_associated_groups, :user_associated_groups)
    .where("group_associated_groups.id IS NULL AND user_associated_groups.id IS NULL")
    .where("last_used < ?", 1.week.ago)
    .delete_all
end

.has_provider?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/associated_group.rb', line 12

def self.has_provider?
  Discourse.enabled_authenticators.any? { |a| a.provides_groups? }
end

Instance Method Details

#labelObject



8
9
10
# File 'app/models/associated_group.rb', line 8

def label
  "#{provider_name}:#{name}"
end