-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
perhaps there is a reason for this behavior, but it feels incorrect to me. the example below shows creating a nested association via 2 different methods. with the first method the before_validation callback is called only once (as expected), however when using <<, {{before_validation}}is called twice. if its not a bug, can someone explain to me why?
class Thing include Mongoid::Document has_many :features end class Feature include Mongoid::Document belongs_to :thing before_validation { puts "FOO!"} end t = Thing.create Feature.create(:thing => t) # returns FOO! once t = Thing.create t.features << Feature.create # returns FOO! twice