I must be overlooking something simple.
I have two models. They have a has_one association. I am trying to destroy the child has_one
association but it's not working.
class Column
has_one :subtable, :class_name => "Table", :foreign_key => :parent_id, :dependent => :destroy
end
// the parent_id column is on the `table` table
class Table
belongs_to :parent_column, :class_name => "Column", :foreign_key => :parent_id
end
If I do
@column.destroy
The table doesn't get destroyed. What am I missing?
Aucun commentaire:
Enregistrer un commentaire