module Mongoid::SeparatedFun

Public Instance Methods

collection_name_for(query_class, separated_key) click to toggle source
# File lib/mongoid/collection_separated/monkey_patches.rb, line 7
def collection_name_for query_class, separated_key
  cache_key = "#{__method__}_#{separated_key}"
  return instance_variable_get "@#{cache_key}" if instance_variable_defined? "@#{cache_key}"
  collection_name = query_class.send(query_class.calc_collection_name_fun, separated_key)
  instance_variable_set "@#{cache_key}", collection_name
  collection_name
end