# Patch for forum model

**URL:** <https://www.ruby-forum.com/t/patch-for-forum-model/47499>\
**Category:** Ruby-Forum\
**Created:** [October 11, 2005, 1:41pm UTC](https://www.ruby-forum.com/t/patch-for-forum-model/47499 "2005-10-11T13:41:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyborch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/90db22/32.png) [@cyborch](https://www.ruby-forum.com/u/cyborch)\
**Post date:** [October 11, 2005, 1:41pm UTC](https://www.ruby-forum.com/t/patch-for-forum-model/47499/1 "2005-10-11T13:41:03Z")

</div>

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.
