Database structure question


#1

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


#2

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