-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
add support for polymorphic associations in active record #814
add support for polymorphic associations in active record #814
Conversation
18d608f
to
753fc7f
Compare
Hey @WriterZephos, thanks for your PR, I have tested it on our project and it does solve the issue. 🙏 It would be awesome if someone would be able to take a look at this and merge it. 🤩 hat would help us a lot! |
Hi @WriterZephos, this works well for my projects and allows me to finally update to 3.4. One side-effect I have found though is noise in my specs coming from line 76 of Otherwise, thank you! I'd love to see this merged/released as soon as possible. 🙏 |
@rhatherall I can take a look at that today or later this week and see if I can make that change. Thanks for trying it out! |
@rhatherall okay that line is removed. |
Awesome @WriterZephos. I have tried it out and all noise gone 🎉 Now all we need is a maintainer approve this 🙏 |
@coorasse are you a maintainer? Could you help us get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!! 👏
Thank you, @coorasse! |
Available now on 3.5.0 |
This PR attempts to add support for polymorphic associations in Active Record. It addresses this issue: #793
The solution works for the most part but there are some difficulties with making it work correctly for using the association name instead of the association id.
I am not very familiar with the CanCan code base so I was hoping to get some help finalizing this and ensuring backwards compatibility.
If anyone could clone this and run the tests, you will see some failures highlighting where things aren't quite working as needed. I have attempted to make some changes to address them without breaking compatibility, but I can't afford to go too deep into this at the time so I am putting it up in hopes someone can take it across the finish line (or tell me how to go about it).
UPDATE: I had a moment of inspiration and found a way to get tests passing. I am still not convinced this is the most elegant or best solution, but tests pass and it allows me to define abilities on polymorphic associations.
Feedback welcome!
Thanks!