Issues with an engine I created using Mongoid

Hi there !

I’m doing a rails engine and I have written several ruby modules in it
that
will be included in the models of the future client Rails applications.

I’m facing a weird issue now : The modules inside my engine use
massively
mongoid. (To append fields to models, declare indexes and stuff) But
when I
use the DateTime type for some fields, it will throw a NoMethod error
on
save like :
undefined method `bson_dump’ for XXXX

I checked the sources of Mongoid and identified where all the extension
logic (for DateTime especially) was implemented.
Is it that I did not properly require dependencies or something ?

Because I have correctly added mongoid gem to my engine dependencies
gemspec and I even require ‘mongoid’ in my engine.rb file, so that all
the
initialization of mongoid could be entirely done before my engine
initializes itself.

Thank you for your attention

One of my module looks like :

module Event

included do
include Mongoid::Document
field :starts_at, :type => DateTime
end

end

class MyEvent
include Engine::Event
end

MyEvent.new :starts_at => DateTime.now

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs