drapergem / draper

Decorators/View-Models for Rails Applications
MIT License
5.23k stars 527 forks source link

Mongo error -> Uninitialized constant ActiveRecord Did you mean? ActiveModel #907

Closed vhazbun closed 3 years ago

vhazbun commented 3 years ago

Setup

We do not use ActiveRecord at all.


About the error

The error occurs for some MongoDB documents.


Stack trace

/gems/draper-4.0.1/lib/draper/query_methods/load_strategy.rb:10 in allowed?
/gems/draper-4.0.1/lib/draper/query_methods.rb:7 in method_missing
app/views/manage/room_offers/show.html.erb:2

Possible solution on our end?

The most evident solution will be to implement this setup https://github.com/drapergem/draper#decorated-query-methods

However, I still do not understand why this occurs for some mongo documents, and not for all of them. Any ideas? Thanks.

vhazbun commented 3 years ago

Seems like we were decorating a nil object. Please disregard.