Module: JsonApiClient::Helpers::Associatable

Extended by:
ActiveSupport::Concern
Included in:
Resource
Defined in:
lib/json_api_client/helpers/associatable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#_cached_associationsObject



45
46
47
# File 'lib/json_api_client/helpers/associatable.rb', line 45

def _cached_associations
  self.__cached_associations ||= {}
end

#_cached_relationship(attr_name) ⇒ Object



57
58
59
60
# File 'lib/json_api_client/helpers/associatable.rb', line 57

def _cached_relationship(attr_name)
  return _cached_associations[attr_name] if _cached_associations.has_key?(attr_name)
  _cached_associations[attr_name] = yield
end

#_clear_cached_relationship(attr_name) ⇒ Object



53
54
55
# File 'lib/json_api_client/helpers/associatable.rb', line 53

def _clear_cached_relationship(attr_name)
  _cached_associations.delete(attr_name)
end

#_clear_cached_relationshipsObject



49
50
51
# File 'lib/json_api_client/helpers/associatable.rb', line 49

def _clear_cached_relationships
  self.__cached_associations = {}
end