-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
There may be cases where we want to preload instance methods which accept arguments
e.g.,
def custom_count(condition)
goldiload("custom_count_#{condition.inspect}") do |ids|
# logic to return condition based counts for all ids
end
endModel.all do |m|
m.custom_count(condition1) # Would fire a single query for all model instances
m.custom_count(condition2) # Would fire another query for all model instances
end- Are there any downsides to including it that way
- If its ok to do so, thinking if passing another optional kwarg
cache_args = []which can be appended to existing cache_key inmake its usage obvious to future users of that APIcache_name ||= block.source_location.join(':')
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels