# Database structure question

**URL:** <https://www.ruby-forum.com/t/database-structure-question/88457>\
**Category:** Rails\
**Created:** [March 11, 2007, 2:41pm UTC](https://www.ruby-forum.com/t/database-structure-question/88457 "2007-03-11T14:41:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJMJMJ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@MJMJMJ](https://www.ruby-forum.com/u/MJMJMJ)\
**Post date:** [March 11, 2007, 2:41pm UTC](https://www.ruby-forum.com/t/database-structure-question/88457/1 "2007-03-11T14:41:32Z")

</div>

Hi,

I have a database question. I have a table called ‘posts’ which holds  
all the blog posts. Now I want to store updates of a specific post in  
the same table. Normal post would get the type ‘normal’ and updates  
would get the type ‘update’. Now for my question: You could have  
multiple updates to a single posts, so how do a correctly name the  
reference table? And how do I put this in the model?

This is my Post model:  
class Post \< ActiveRecord::Base

has\_and\_belongs\_to\_many :tags  
has\_one :rating

end

Thanks,  
MJ

---

<div class="post-metadata">

**Author:** ![MJMJMJ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@MJMJMJ](https://www.ruby-forum.com/u/MJMJMJ)\
**Post date:** [March 11, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/database-structure-question/88457/2 "2007-03-11T16:44:59Z")

</div>

On Mar 11, 2007, at 2:41 PM, MJ wrote:

> I have a database question. I have a table called ‘posts’ which holds  
> all the blog posts. Now I want to store updates of a specific post in  
> the same table. Normal post would get the type ‘normal’ and updates  
> would get the type ‘update’. Now for my question: You could have  
> multiple updates to a single posts, so how do a correctly name the  
> reference table? And how do I put this in the model?

I am not sure I understand the question correctly, would  
acts\_as\_versioned[\*] help?

– fxn

[\*] [http://agilewebdevelopment.com/plugins/acts\_as\_versioned\_association](http://agilewebdevelopment.com/plugins/acts_as_versioned_association)
