Can''t say as I''ve used the t.references command yet, but a
look at your
table definition for workbook_contents should tell you whether you have
a workbook_id field in there.
What I do find curious is that you have the :dependent => :destroy in
both models, workbook and workbook_content.
If the user only ever deletes the workbook, then that model is the one
that needs the dependent clause. I''m not sure the effects of having the
clause on both models, and I''ve never had to code the dependent -
destroy from the belongs_to side of the association.
From the Rails Framework Docs, it does note that dependent can be used
as an option, but it does caution that:
:dependent - If set to :destroy, the associated object is destroyed when
this object is. If set to :delete, the associated object is deleted
without calling its destroy method. This option should not be specified
when belongs_to is used in conjunction with a has_many relationship on
another class because of the potential to leave orphaned records behind.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---