views:

29

answers:

0

Say I have two models, Apples and Oranges, and they are both associated with a description in a Text model. Text is a separate class as I'd like to keep track of the different revisions. Is the following correct? Is there a better way to do this?

[Apple]

  has_one :text, :as => :targit, :order => 'id DESC'   
  has_many :revisions, :class_name => 'Text', :as => :targit, :order => 'id', :dependent => :destroy

[Text]

   belongs_to :targit, :polymorphic => true