Forum: Ruby on Rails Database structure question

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.
MJ (Guest)
on 2007-03-11 15:41
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
Xavier N. (Guest)
on 2007-03-11 17:44
(Received via mailing list)
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_ver...
This topic is locked and can not be replied to.