-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Mongoid 3.1.0
class User
include Mongoid::Document
embeds_many :labels
end
class Label
include Mongoid::Document
end
class LabelsController < ApplicationController
def destroy
label = current_user.labels.find(params[:id])
label.destroy
end
end
For a label with id 'abc', calling DELETE /labels/abc destroys the current user.
Changing the Label class to explicitly declare it "embedded_in :user" solves this problem, but it seems to me that deleting an embedded document should never result in deleting the containing document.