次のような大規模で複雑な User モデルがあります。
class User
class Link
include DataMapper::Resource
property :id, Serial, :key => false
belongs_to :follower, :model => 'User', :key => true
belongs_to :followed, :model => 'User', :key => true
end
include DataMapper::Resource
property :id, Serial
property :username, String, :required => true
has n, :links_to_followers, :model => 'User::Link', :child_key => [:followed_id]
has n, :links_to_followed, :model => 'User::Link', :child_key => [:follower_id]
has n, :comments
has 1, :profile_image
end
私の問題は、Datamapper が破棄させてくれないことです。これは、Datamapper が破棄されていない子オブジェクトを含むオブジェクトを破棄したくないためだと考えたので、links_to_followers、links_to_followed、下にあるコメント、およびプロフィール画像で destroy を呼び出すメソッド destroy_deep を追加しました (これらはすべて正しく破棄されます)。 .
しかし、その後 user.destroy を呼び出しても、ユーザーは破棄されません。いかなる種類のエラー メッセージもありません。欠落しているカスケード削除コマンドのようなものはありますか?