-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Associations, Callbacks
-
Fully Compatible
I experienced the following behavior:
class Parent include Mongoid::Document embeds_many :things, :cascade_callbacks => true before_create :initialize_first_thing def initialize_first_thing self.things << Thing.new(:name => "first") end end class Thing include Mongoid::Document include Mongoid::Timestamps embedded_in :parent field :name, :type => String before_create lambda {puts "before_create"} end
When I create the parent, the before_create on Thing does not run, neither the timestamps are saved.
Am I missing something?
- is duplicated by
-
MONGOID-4411 Update on root document does not invoke before_save callback correctly in embedded docs with cascade_callbacks: true
- Closed