-
Notifications
You must be signed in to change notification settings - Fork 173
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
Cannot fetch_multi_by polymorphic field #392
Comments
Right, there isn't cache_attribute by multiple columns support, which means there is no cache_index by multiple columns support. In your example
it looks like you could add
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have made a new rails app with these models on the latest master of identity_cache:
models/item.rb
models/foo_widget.rb
models/bar_widget.rb
schema:
I would like to be able to run this:
But, that generates an invalid SQL query:
I can't change my cache_index to
cache_index :widget_id, :widget_type
becausefetch_multi_by
methods are only generated for cache_indexes with only one field.I used to be able to pass in arrays into the
fetch_by_widget_id_and_subject_type
methods in 0.5.1, but now that doesn't work on master (e.g. an array of widget_ids generates a SQL query with NULL as the widget_id value). I guess was never the way those methods were intended to be used, but now I don't have a way to bulk fetch Items in a way that won't make N+1 queries when the cache is missed.The text was updated successfully, but these errors were encountered: