Class: CiviCrm::CustomField
- Inherits:
-
BaseResource
- Object
- Resource
- BaseResource
- CiviCrm::CustomField
- Defined in:
- lib/civicrm/resources/custom_field.rb
Constant Summary collapse
- @@_custom_field_cache =
{}
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Actions::Destroy
Methods included from Actions::Update
Methods included from Actions::Create
Methods included from Actions::Find
Methods included from Actions::List
Methods inherited from Resource
#as_json, #attribute, #attributes, build_from, entity, entity_class_name, #initialize, #inspect, #method_missing, #refresh_from, #to_hash, #to_json, #to_s
Constructor Details
This class inherits a constructor from CiviCrm::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CiviCrm::Resource
Class Method Details
.[](entity, field, cache: true) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/civicrm/resources/custom_field.rb', line 7 def self.[](entity, field, cache: true) cache_key = name 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=#{name}" ) end |
Instance Method Details
#key ⇒ Object
31 32 33 |
# File 'lib/civicrm/resources/custom_field.rb', line 31 def key "custom_#{id}" end |