-
Notifications
You must be signed in to change notification settings - Fork 368
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
Update crutch.rb to allow crutch inter-dependency with efficiency #965
base: master
Are you sure you want to change the base?
Conversation
Adds support for passing all crutches into a crutch definition, to be able to form a chain of crutches such that a field can depend and load only what it needs, instead of loading multiple objects at times, which might not all be required always.
Thanks @akshay58538 for your PR Overall I think looks good, but you miss 2 things
Thanks! |
Yeah, and fix CI please (rubocop specifically) |
hey @akshay58538, by Documentation I've meant updating of the https://github.com/toptal/chewy/blob/master/README.md and do not forget to add changes into https://github.com/toptal/chewy/blob/master/CHANGELOG.md |
@konalegi Unrelated, but still asking. Do you know why mongoId adapter was removed in #776 ? We were trying to update to latest version of chewy and realized much later, that mongoid adapter itself has been dropped from chewy. Isnt mongo+ES a very standard architecture in many companies (including mine)? |
Hmm I just came across this issue hoping this was a resolution to a problem I'm having which I noticed when you have more than one crutch defined (eg. crutch a, crutch b). It seems to evaluate both crutches during the update_fields use case (where the update_fields = [:a], i would only expect crutch a to evaluate). Maybe I'll have to open another issue for this to enable lazy evaluation of crutches. |
Adds support for passing all crutches into a crutch definition, to be able to form a chain of crutches such that a field can depend and load only what it needs, instead of loading multiple objects at times, which might not all be required always.
Earlier:
Now:
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).