lib/cloud_controller/rest_controller/model_controller.rb
# Enumerate the related objects to the one with the given guid.
#
# @param [String] guid The GUID of the object for which to enumerate related
# objects.
#
# @param [Symbol] name The name of the relation to enumerate.
Enumerate the related objects to the one with the given guid.
Enumerate the related objects to the one with the given guid .
def enumerate_related(guid, name)
      logger.debug "cc.enumerate.related", guid: guid, association: name
      obj = find_guid_and_validate_access(:read, guid)
      associated_model = model.association_reflection(name).associated_class
      associated_controller = VCAP::CloudController.controller_from_model_name(associated_model)
      associated_path = "#{self.class.url_for_guid(guid)}/#{name}"
      filtered_dataset =
        Query.filtered_dataset_from_query_params(
          associated_model,
          obj.user_visible_relationship_dataset(name,
                                                VCAP::CloudController::SecurityContext.current_user,
                                                SecurityContext.admin?),
          associated_controller.query_parameters,
          @opts
        )
      Paginator.render_json(associated_controller, filtered_dataset, associated_path, @opts)
    end
def enumerate_related ( guid , name ) logger . debug "cc.enumerate.related" , guid : guid , association : name obj = find_guid_and_validate_access ( :read , guid ) associated_model = model . association_reflection ( name ) . associated_class associated_controller = VCAP :: CloudController . controller_from_model_name ( associated_model ) associated_path = "#{self.class.url_for_guid(guid)}/#{name}" filtered_dataset = Query . filtered_dataset_from_query_params ( associated_model , obj . user_visible_relationship_dataset ( name , VCAP :: CloudController :: SecurityContext . current_user , SecurityContext . admin? ) , associated_controller . query_parameters , @opts ) Paginator . render_json ( associated_controller , filtered_dataset , associated_path , @opts ) end
Enumerate the related objects to the one with the given guid.
Enumerate the related objects to the one with the given guid .
guid
<not_specific>
name
<not_specific>
<not_specific>
name The name of the relation to enumerate.
name The name of the relation to enumerate .