File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,14 @@ class Forum < ActiveRecord::Base
24
24
belongs_to :posted_by , :class_name => 'User' , :foreign_key => 'posted_by'
25
25
26
26
def delete_all_messages
27
- sql = "delete from forum where group_forum_id = #{ self . group_forum_id } "
28
- puts "Running '#{ sql } '..."
29
- Forum . connection . execute ( sql )
27
+ #sql = "delete from forum where group_forum_id = #{self.group_forum_id}"
28
+ #puts "Running '#{sql}'..."
29
+ #Forum.connection.execute(sql)
30
+ Forum . find_each ( :batch_size => 100 , :conditions => [ "group_forum_id = ?" , group_forum_id ] ) do |f |
31
+ puts "Deleting #{ f . subject } "
32
+ f . destroy
33
+ end
34
+ nil
30
35
end
31
36
end
32
37
Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ class ForumGroup < ActiveRecord::Base
16
16
17
17
set_table_name "forum_group_list"
18
18
set_primary_key "group_forum_id"
19
-
19
+
20
20
belongs_to :group
21
21
has_many :forums , :foreign_key => "group_forum_id"
22
22
23
+ def disallow_anonymous_postings!
24
+ self . update_attribute :allow_anonymous , false
25
+ end
26
+
23
27
end
24
28
You can’t perform that action at this time.
0 commit comments