-
-
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
sort_link on polymorphic association #421
Comments
+1 |
+1 It looks like sort_link changes the actual reference in the generated link: instead of xxxable_of_Ymodel_type_some_attr it becomes xxxable_of_ymodel_type_some_attr (notice that the name of the model is downcased). |
Hi guys, could you please provide a failing test case and/or code to reproduce this issue as per the Contributing Guide? @eneagoe and @glaucocustodio, it's not clear if you two are reporting the same issue. Please contribute a pull request to fix the issue, or provide the information mentioned in the Contributing Guide so that someone else can reproduce it without spending time guessing what the exact issue is. If neither one happens in the next 2 weeks, we'll close the issue as stale/unactionable. Thanks for your help 😃 |
I'll try to see if I can write a failing test case, but meanwhile I can point out where the problem comes from: https://github.com/activerecord-hackery/ransack/blob/master/lib/ransack/helpers/form_helper.rb#L86 |
@glaucocustodio's issue seems to be a different one, however, because the change mentioned by @eneagoe was not committed in the |
Actually, that might be correct. |
Fixes sort on polymorphic association #421
@eneagoe if that is a reliable workaround, would you mind adding it to the readme and wiki? To begin looking for a solution, a failing spec would be a good place to start. |
How to sort_link with multiple polymorphic relationship ? |
Closing as a workaround exists. |
Hi guys, I am on Rails 4.1 (Ruby 2.1.2) and ransack branch: 'rails-4.1'.
I have this search field working as expected:
xxxable_of_Ymodel_type_some_attr_gteq
But when I try to sort by the same field:
= sort_link(@q, :xxxable_of_Ymodel_type_some_attr
I get this error:
uninitialized constant Model::Xxxable
Sort link does not work with polymorphic association? Thank you.
The text was updated successfully, but these errors were encountered: