Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models are becoming subclasses of themselves #155

Open
jpatters opened this issue Jan 20, 2024 · 1 comment
Open

Models are becoming subclasses of themselves #155

jpatters opened this issue Jan 20, 2024 · 1 comment

Comments

@jpatters
Copy link

Something in this project is causing rails model classes to become subclasses of themselves during runtime. Even just loading the motor admin list page for a model was wreaking havoc in our system.

This is a really weird one and the only thing I have to prove it is a (somewhat) bug that it surfaced in rolify. The model in question was using resourcify and generating bad queries after simply loading the list page for the model in motor admin.

The bad queries were coming from here https://github.com/RolifyCommunity/rolify/blob/master/lib/rolify/adapters/active_record/resource_adapter.rb#L13-L26 because klasses had the same class multiple times (ie. ['Organization', 'Organization']) and the only way I can see that can happen is if a class is a subclass of itself (see https://github.com/RolifyCommunity/rolify/blob/master/lib/rolify/adapters/base.rb#L27-L29).

I initially thought this might be a bug in the rails class dependency tracking, however the issue persisted after upgrading to rails 7.1 and ruby 3.1 where they use the new ruby builtin Class.subclasses instead of their own tracking.

For now, I've had to remove motor admin from our project.

@chrisdmacrae
Copy link

This issue is breaking multiple rails apps using Motor admin that I'm aware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants