-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Ransack not_eq not working #925
Comments
I haven't find a good way to fix this, @jonatack could you please have a look? ^_^ |
Try declaring the table name in the STI model. @msyesyan |
I think I found the issue, not sure, but if I change in the Context#extract_correlated_key to detect children its working.. when Arel::Nodes::And |
@ciihla Can you create a PR with your solution? |
I don't have time for writing proper tests, etc, but basically, this is working for us:
|
It'd be ok to just create a PR with the patch, I can handle tests later. |
Thanks! |
I tried to reproduce this with a spec using the models in the original post, but it all worked fine (I had to modify the models to actually inherit from |
undefined method eq for #<Arel::Nodes::Equality:0x007fb12685a2d0>
I found there is a closed issue about this issue. And I have found the repro steps. The issues occurs when ransack a association attributes and the child model extend a parent model.
for example:
I have followed the source code, and I found the error code is in
adapters/active_record/context.rb:193
the
expect(correlated_key.is_a? Ransack::Nodes::Attribute).to be_true
is false, becausecorrelated_key
is a Arel::Nodes::EqualityI don't know how to fix this, can you help ? @seanfcarroll thanks
The text was updated successfully, but these errors were encountered: