Mongoid::Persistable::Creatable::ClassMethods.module_eval do def create(attributes = nil, &block) begin super rescue Mongo::Error::OperationFailure => e Rails.logger.error "failed to create notifications #{e.message}, #{e.backtrace}" raise end end end Hello all, I'm trying to override a method from mongoid gem. So I've implemented the above method in config/initializers/mongo.rb, expecting my create method to run as defined in the gem, while leaving error log in case it there is a Mongo::Error::OperationFailure. But instead it gives me this error.
[1] pry(main)> Notification.create(id: 'ididididididid') NoMethodError: super: no superclass method `create' for Notification:Class I would like to know why this error occurs and how I can fix it. Thank you.
Mongo::Error::OperationFailure (can't have multiple _id fields in one document (2))from the moment I updated my Rails application to 5.1. There was no case of such error while using 5.0. So I need to know where this error log is coming from. Any suggestions?Notification.createmethod!