# Topic Moving

**URL:** <https://www.ruby-forum.com/t/topic-moving/145550>\
**Category:** Rails\
**Created:** [August 11, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/topic-moving/145550 "2008-08-11T13:56:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [August 11, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/topic-moving/145550/1 "2008-08-11T13:56:34Z")

</div>

I’m trying to work out how to move topics from one forum to another.  
All my code is located here: [GitHub - radar/rboard: A fully featured forum system compatible with Rails 2.3](http://github.com/Radar/rboard/tree/master)

It just doesn’t seem to be updating last\_post\_id and  
last\_post\_forum\_id correctly (or eloquently) when moving a post. The  
method in question is move! in the topic model. Is there a “better”  
way to do it?

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [August 11, 2008, 2:18pm UTC](https://www.ruby-forum.com/t/topic-moving/145550/2 "2008-08-11T14:18:51Z")

</div>

On 11 Aug 2008, at 12:56, Ryan B. wrote:

> I’m trying to work out how to move topics from one forum to another.  
> All my code is located here: [http://github.com/Radar/rboard/tree/](http://github.com/Radar/rboard/tree/)  
> master
> 
> It just doesn’t seem to be updating last\_post\_id and  
> last\_post\_forum\_id correctly (or eloquently) when moving a post. The  
> method in question is move! in the topic model. Is there a “better”  
> way to do it?

update\_last\_post in forum.rb should be doing self.last\_post= and  
self.last\_post\_forum= (right now you’re just setting a local variable)

Fred

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [August 11, 2008, 11:50pm UTC](https://www.ruby-forum.com/t/topic-moving/145550/3 "2008-08-11T23:50:37Z")

</div>

Wow I can’t believe it was that easy.

On Aug 11, 9:17 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [August 12, 2008, 9:55pm UTC](https://www.ruby-forum.com/t/topic-moving/145550/4 "2008-08-12T21:55:39Z")

</div>

On 11 Aug 2008, at 22:50, Ryan B. wrote:

> Wow I can’t believe it was that easy.

Surprisingly easy mistake to make (and perhaps why some people get in  
the habit of writing self when they don’t need to)

Fred

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [August 13, 2008, 12:01am UTC](https://www.ruby-forum.com/t/topic-moving/145550/5 "2008-08-13T00:01:02Z")

</div>

The code does not appear to be updating the last\_post\_id and  
last\_post\_forum\_id when moving topics out of sub-forums. The idea is  
that if a post is the real last post in a sub-forum AND it’s parent(s)  
it should update them all with that information. Am I doing this the  
hard way?
