-
Notifications
You must be signed in to change notification settings - Fork 409
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
fix: Prefix class names with Pagy module to prevent collisions #726
Conversation
Thank you @LuukvH. Admittedly, the omissions are a bit pagy-centric 😁. |
@ddnexus I am not sure why this test is failing. Doesn't seem to relate to my changes? Could you point me in the correct direction, then i can try to fix it. |
Hi @LuukvH , thank you for your persistence. Please, keep your PR branch rebased on master. That will take care of the necessary updates that make your branch fail (not your code fault) |
@LuukvH I've tried to verify that there would indeed exists a collision, but I couldn't reproduce any of such collisions. Please, could you use any playground app to reproduce it? |
@ddnexus Sorry, i needed some time to make the example. Just did a minimal setup with pagy. And defined a Calendar module: https://github.com/LuukvH/pagy_collision_example/blob/main/app/models/calendar.rb inside the app. As a result pagy is crashing since for example Calendar::Unit is not defined. I hope this offers you enough context. |
@LuukvH ... Thanks for your example app, but we need a modified playground app to reproduce - as requested in my previous message. I tried to add a bare You can see it here. Please, modify that app to make it fail, so finding out the problem will be trivial. You can read the playground apps doc for a quick way to try and develop it. Thank you. |
f0194bf
to
99bc0ba
Compare
@ddnexus i changed the rails playground app as a breaking example. The calendar one is the wrong place to do it, since there Calendar::Unit is actually defined. |
Where can I find the failing app? |
@ddnexus I added it to this pr. See the rails.ru. I ran it, with and without the change. |
@ddnexus Let me know if you require anything else. |
This commit updates the code to prefix certain class names with the Pagy module name. The change is necessary to prevent potential collisions with class names defined in Rails applications. These adjustments ensure that the Pagy pagination library operates correctly without interfering with other classes that might exist within the application namespace. The revised code now properly isolates Pagy-specific classes, enhancing compatibility and stability feat: Break it
OK, so the problem is not that the pagy modules are "conflicting" with app defined classes. It's that when they are not defined... the generic ruby module resolution of the modules passed to the The 2d61ac7 commit absolutizes all the namespaces passed to the Please, let me know if that solves all the possible cases. |
@ddnexus Seems a goog improvement to me to absolutize the modules. |
Thnk you! |
This commit updates the code to prefix certain class names with the Pagy module name. The change is necessary to prevent potential collisions with class names defined in Rails applications.
These adjustments ensure that the Pagy pagination library operates correctly without interfering with other classes that might exist within the application namespace. The revised code now properly isolates Pagy-specific classes, enhancing compatibility and stability