You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
Not sure if I did not set it up correctly. But I failed to get the expected result set from self-referential association.
I have a Category model, which has many sub-categories:
class Category < ActiveRecord::Base
belongs_to :parent_category, class_name: :Category
has_many :child_categories, class_name: :Category, foreign_key: "parent_category_id"
end
Then in my filter class:
class CategoriesFilter < FilterMe::ActiveRecordFilter
model Category
association :parent_category, filter_class: CategoriesFilter
field :name, [:eq]
end
Then when I do the filter with the following filter params:
Thanks for filing the issue. I'm excited to hear that someone else is using -- or attempting to from the appearance of it -- the filtering gem. Let me put together a test case for your issue and get it fixed.
Not sure if I did not set it up correctly. But I failed to get the expected result set from self-referential association.
I have a Category model, which has many sub-categories:
Then in my filter class:
Then when I do the filter with the following filter params:
But this generates the following SQL query:
Guess the WHERE clause should be "parent_categories_categories"."name" instead of "categories"."name".
Any idea?
The text was updated successfully, but these errors were encountered: