Skip to content

Commit 5e5e521

Browse files
author
Tom Copeland
committed
Filling in the MailingList <=> Group association
1 parent a1ce774 commit 5e5e521

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: app/models/group.rb

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def scm
7171
has_many :news_bytes
7272
has_many :roles
7373
has_many :disk_usages, :dependent => :destroy
74+
has_many :mailing_lists, :dependent => :destroy
7475

7576
belongs_to :license, :foreign_key => 'license'
7677

Diff for: app/models/mailing_list.rb

+8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,21 @@
1414
#
1515

1616
class MailingList < ActiveRecord::Base
17+
1718
set_table_name "mail_group_list"
19+
set_primary_key "group_list_id"
20+
1821
belongs_to :owner, :class_name => "User", :foreign_key => "list_admin"
22+
belongs_to :group
23+
1924
named_scope :not_created, :conditions => "status != 2"
2025
named_scope :deleted, :conditions => {:is_public => 9}
26+
2127
def self.mailman_list_lists
2228
system("/var/mailman/bin/list_lists -b > /tmp/list_lists")
2329
File.read("/tmp/list_lists").split("\n")
2430
end
31+
2532
def self.hourly_cron
2633
list_lists_cache = self.mailman_list_lists
2734
not_created.each do |mailing_list|
@@ -42,6 +49,7 @@ def self.hourly_cron
4249
end
4350
end
4451
end
52+
4553
def is_deleted?
4654
is_public == 9
4755
end

0 commit comments

Comments
 (0)