Forum: Ruby-Forum.com patch for forum model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
54d2432715c1e9be4d6b1fe5b7c85141?d=identicon&s=25 cyborch (Guest)
on 2005-10-11 13:41
It seems to me that the forum available for download has a few bugs...
I'm attempting to fix them as I read through the code.

Here's a patch to models/forum.rb

--- forum.rb.orig       2005-10-11 13:26:41.000000000 +0200
+++ forum.rb    2005-10-11 13:27:21.000000000 +0200
@@ -33,11 +33,11 @@
   end

   def get_topics_for_list(range, include_deleted=false)
-    self.topics.find_all(
-      ('deleted = 0' unless include_deleted),
-      'last_post_created_at DESC',
-      "#{range.begin} OFFSET #{range.end - range.begin + 1}"
-    )
+               conditions = "forum_id = ?"
+               conditions += " and deleted = 0" unless
(include_deleted)
+               Topic.find(:all, :conditions => [conditions, id],
+                       :offset => range.begin, :limit => (range.end -
range.begin),
+                       :order => "last_post_created_at DESC")
   end

   # Create a new post & topic in this forum.
This topic is locked and can not be replied to.