ruby on rails - Engine using Mongoid - Mongoid not properly loaded? -
i'm doing rails engine , have set several ruby modules in included in models of client rails application. i'm facing weird issue : modules within engine utilize massively mongoid. (to append fields models, declare indexes , stuff) when utilize datetime type fields, throw nomethod error on save : undefined method `bson_dump' xxxx
i checked sources of mongoid , identified extension logic (for datetime especially) implemented. did not require dependencies or ?
thank attention
one of module looks :
module engine::event included include mongoid::document field :starts_at, :type => datetime end end # in client application class myevent include engine::event end myevent.new :starts_at => datetime.now
here part of stacktrace of error :
nomethoderror: undefined method `__bson_dump__' wed, 20 feb 2013 09:47:58 +0000:datetime /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/bson/extensions/hash.rb:36:in `block in __bson_dump__' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/bson/extensions/hash.rb:35:in `each' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/bson/extensions/hash.rb:35:in `__bson_dump__' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/bson/document.rb:11:in `serialize' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/protocol/message.rb:129:in `block in serialize_documents' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/protocol/message.rb:128:in `each' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/protocol/message.rb:128:in `serialize_documents' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/protocol/message.rb:287:in `serialize' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/connection.rb:153:in `block in write' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/connection.rb:151:in `each' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/connection.rb:151:in `write' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:560:in `block (2 levels) in flush' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:129:in `ensure_connected' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:559:in `block in flush' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:574:in `logging' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:558:in `flush' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:547:in `process' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:259:in `insert' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/session/context.rb:63:in `block in insert' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/session/context.rb:109:in `block in with_node' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/cluster.rb:205:in `block in with_primary' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/node.rb:189:in `ensure_primary' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/cluster.rb:204:in `with_primary' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/session/context.rb:108:in `with_node' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/session/context.rb:56:in `insert' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/collection.rb:91:in `block in insert' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/session.rb:312:in `with' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/moped-1.3.2/lib/moped/collection.rb:90:in `insert' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/mongoid-3.0.20/lib/mongoid/persistence/operations/insert.rb:27:in `block in persist' /users/codi/.rvm/gems/ruby-1.9.3-p327/gems/mongoid-3.0.20/lib/mongoid/persistence/insertion.rb:25:in `block (2 levels)
that should not happen if mongoid loaded ... :s
ruby-on-rails ruby mongoid
No comments:
Post a Comment