Sha256: 29c6c6f8de65931ff88046d262235a822720d30ab289f3b33d8c978e3f8518ff
Contents?: true
Size: 815 Bytes
Versions: 4
Compression:
Stored size: 815 Bytes
Contents
module CiviCrm class CustomField < BaseResource entity :custom_field @@_custom_field_cache = {} def self.[](entity, field, cache: true) cache_key = [entity.underscore, field].join("/") if cache && @@_custom_field_cache.key?(cache_key) return @@_custom_field_cache[cache_key] end field = find_by( "custom_group_id.extends" => entity, "custom_group_id.name" => entity, "name" => field, "options" => { "or" => [["custom_group_id.extends", "custom_group_id.name"]] } ) if field @@_custom_field_cache[cache_key] = field if cache return field end raise Errors::NotFound.new( "CustomField of #{entity} with name=#{field}" ) end def key "custom_#{id}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems