I’m a rails beginner and I would appreciate any help on this problem.
I have two models, Workbook and WorkbookContent. Workbook holds
uploaded Excel workbooks (through attachment_fu). I want to parse the
data into fields in WorkbookContent.
My Workbook model uses
has_one :workbook_content, :dependent => :destroy
and my WorkbookContent model uses
belongs_to :workbook_content, :dependent => :destroy
My understanding is that, if Workbook includes the dependent => destroy
property, all its children will be destroyed upon its destruction.
However, when I look in the MySQL database, I can see that the child is
not being destroyed. Is this something I am doing wrong with my
migration? My migration for workbook__contents currently contains the
which I found while scouring the internet. Before, I had no explicit
mention of workbook and did not explicitly create a workbook_id column.
I don’t understand why I can’t get the child to be destroyed. Any help
would be greatly appreciated!
Also, if anyone can guide me to some good reference materials on
associated models, I would be very grateful.