You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug manifests as a mysterious, difficult to track ArgumentError, and is particularly gnarly to track down because it will only happen with "lazily loaded" constants (like for instance the Rails preloader.)
Say you have a setup like this:
classThingincludeVirtus.modelend
And in a different file:
classThing::Collectionend
A call that lazily loads the Thing::Collection will result in the argument error because Virtus const_missing extensions will autoload the Virtus::Attributes::Collection constant.
I don't know enough about Virtus internals to really attempt a fix but this key being present in the TypeLookup cache is probably the salient problem.
The problem can be mitigated by either changing the name of your Collection class or explicitly requiring it AFTER your class definition has opened like so.
This bug manifests as a mysterious, difficult to track ArgumentError, and is particularly gnarly to track down because it will only happen with "lazily loaded" constants (like for instance the Rails preloader.)
Say you have a setup like this:
And in a different file:
A call that lazily loads the
Thing::Collection
will result in the argument error because Virtus const_missing extensions will autoload the Virtus::Attributes::Collection constant.I don't know enough about Virtus internals to really attempt a fix but this key being present in the TypeLookup cache is probably the salient problem.
The problem can be mitigated by either changing the name of your
Collection
class or explicitly requiring it AFTER your class definition has opened like so.The text was updated successfully, but these errors were encountered: