-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Best explained with a spec:
require "spec_helper" describe "A same-class referenced_in association" do before do class Foo include Mongoid::Document referenced_in :parent, class_name: "Foo" end end context "setting `a.parent = b'" do let(:a) { Foo.new } let(:b) { Foo.new } before do a.parent = b end it "sets a.parent" do a.parent.should == b end it "does not set b.parent" do b.parent.should be_nil end end end
The second example fails: b.parent is set to a.