{"record":{"id":"91a168e9ca10c784","repo":"mongodb/mongoid","slug":"to-enable-around-callbacks-for-embedded-documents","errorCode":null,"errorMessage":"To enable around callbacks for embedded documents, set Mongoid::Config.around_callbacks_for_embeds to true.","messagePattern":"To enable around callbacks for embedded documents, set Mongoid::Config\\.around_callbacks_for_embeds to true\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/mongoid/interceptable.rb","lineNumber":232,"sourceCode":"    end\n\n    # Execute the before callbacks of given kind for embedded documents.\n    #\n    # @param [ Symbol ] kind The type of callback to execute.\n    # @param [ Array<Document> ] children Children to execute callbacks on.\n    # @param [ Array<ActiveSupport::Callbacks::CallbackSequence, ActiveSupport::Callbacks::Filters::Environment> ] callback_list List of\n    #   pairs of callback sequence and environment. This list will be later used\n    #   to execute after callbacks in reverse order.\n    #\n    # @api private\n    def _mongoid_run_child_before_callbacks(kind, children: [], callback_list: [])\n      children.each do |child|\n        chain = child.__callbacks[child_callback_type(kind, child)]\n        env = ActiveSupport::Callbacks::Filters::Environment.new(child, false, nil)\n        next_sequence = compile_callbacks(chain)\n        unless next_sequence.final?\n          Mongoid.logger.warn(\"Around callbacks are disabled for embedded documents. Skipping around callbacks for #{child.class.name}.\")\n          Mongoid.logger.warn('To enable around callbacks for embedded documents, set Mongoid::Config.around_callbacks_for_embeds to true.')\n        end\n        next_sequence.invoke_before(env)\n        return false if env.halted\n\n        env.value = !env.halted\n        callback_list << [ next_sequence, env ]\n      end\n      callback_list\n    end\n\n    # Execute the after callbacks.\n    #\n    # @param [ Array<ActiveSupport::Callbacks::CallbackSequence, ActiveSupport::Callbacks::Filters::Environment> ] callback_list List of\n    #   pairs of callback sequence and environment.\n    def _mongoid_run_child_after_callbacks(callback_list: [])\n      callback_list.reverse_each do |next_sequence, env|\n        next_sequence.invoke_after(env)\n        return false if env.halted","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/interceptable.rb#L214-L250","documentation":"Error \"To enable around callbacks for embedded documents, set Mongoid::Config.around_callbacks_for_embeds to true.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/interceptable.rb:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}