-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Filter by HABTM association throws exception #515
Comments
+1 |
filter :categories_id, :as => :check_boxes stumbled upon it the other day |
That's great - thanks phillyslick. |
I get duplicates if I select two categories (although it works!). Did you guys find a way to dedupe records? (see #982) |
^ still having this issue. #982 above updated in comments with rly shitty workaround :P |
thanks :) |
@pcreux dunno yet, I will work again on the admin part in a couple of weeks, I'll report back! Thanks for the heads-up! |
Is this commit merged in master? If so, it did not fix the duplicate results issue for me. |
I'm getting the error on 0.4.2 with |
My models Product and Category have a many-to-many relationship via HABTM.
I thought that for products, I could just say:
filter :categories, :as => :check_boxes, :collection => proc { Category.all }
... but this throws an error:
undefined method `category_ids_in' for #MetaSearch::Searches::Product:0x000001079b25c8
How would I get filtering to work for this relationship? I can't specify the bridging table (categories_products) as the source of the collection, because it's a HABTM relationship so there's no such class as CategoryProduct. I don't want to (and shouldn't have to) change my data model.
The text was updated successfully, but these errors were encountered: