-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
undefined method `polymorphic?' for ActiveRecord::Reflection::PolymorphicReflection #1039
Comments
Don't update `ransack` until activerecord-hackery/ransack#1039 is fixed
* Bump dependencies Don't update `ransack` until activerecord-hackery/ransack#1039 is fixed * Fix SMS tests when ESENDEX_USERNAME env variable is present. * Remove dependent procedures feature. * Rubocop issue * Added missing test.
Yup, I hit the same issue... and spent ~2h investigating and experimenting and reverting The newly introduced |
|
Same issue here, I see there is an issue opened in the polyamorous project but no response. I've just pinned to 2.1.1 until the library is updated :\ |
@PhilCoggins or somebody else having this issue, can you try #1077 against your apps? |
Closed due to inactivity. Please reopen if still an issue. |
@seanfcarroll There's an open PR for this issue that you just commented in... |
@PhilCoggins which one? |
I'll reopen it. If someone from the community can work on this it will be great. |
@seanfcarroll I have started to look at this again as my organization is blocked on Rails upgrades until this issue is resolved. The PR open for this issue is not #1081, it is #1077. This issue is unrelated to Rails 6 (though I have confirmed this is also broken in Rails 6), but rather how Ransack's mechanism for forming polymorphic joins is fundamentally broken since Rails 5.2. If you have time, could you please see the linked PR and offer any guidance on how we can fix polymorphic joins? |
I am using Rails 5.2.3, and Ransack latest master(e17f1c6) and have found a potential bug.
It looks like this issue surfaces when trying to filter by a
has_many through
relationship where thesource
is a polymorphicbelongs_to
.I am getting the below error:
I have forked your repository and produced a failing test case in a separate branch here. I had to nudge the models a bit to get my test case to work, but it does closely resemble a relationship that I have in my production application.
I have monkey-patched with the below, but I'm really not sure if this is what it's supposed to be (everything seems to be working great so far):
Any assistance would be great, happy to work up a PR if someone can provide a nudge in the right direction.
Thanks for your time!
EDIT
I found an issue with the above monkey patch that was causing some queries with polymorphic joins to not add a filter on the polymorphic type. I have updated the original code in this issue.
The text was updated successfully, but these errors were encountered: