diff --git a/app/controllers/api/base_controller/renderer.rb b/app/controllers/api/base_controller/renderer.rb index 5aa7a10124e..14d7512061d 100644 --- a/app/controllers/api/base_controller/renderer.rb +++ b/app/controllers/api/base_controller/renderer.rb @@ -436,6 +436,7 @@ def render_options(resource, data = {}) collection.virtual_reflections.keys.collect(&:to_s)).sort } end + options[:subcollections] = Array(collection_config[resource].subcollections).sort options[:data] = data render :json => options end diff --git a/spec/requests/api/arbitration_rule_spec.rb b/spec/requests/api/arbitration_rule_spec.rb index 1e61ed749f3..a9738541e00 100644 --- a/spec/requests/api/arbitration_rule_spec.rb +++ b/spec/requests/api/arbitration_rule_spec.rb @@ -185,10 +185,12 @@ attributes = (ArbitrationRule.attribute_names - ArbitrationRule.virtual_attribute_names).sort.as_json reflections = (ArbitrationRule.reflections.keys | ArbitrationRule.virtual_reflections.keys.collect(&:to_s)).sort + subcollections = Array(Api::ApiConfig.collections[:arbitration_rules].subcollections).collect(&:to_s).sort expected = { 'attributes' => attributes, 'virtual_attributes' => ArbitrationRule.virtual_attribute_names.sort.as_json, 'relationships' => reflections, + 'subcollections' => subcollections, 'data' => { 'field_values' => ArbitrationRule.field_values } diff --git a/spec/requests/api/querying_spec.rb b/spec/requests/api/querying_spec.rb index 5329d16b105..954715f71e9 100644 --- a/spec/requests/api/querying_spec.rb +++ b/spec/requests/api/querying_spec.rb @@ -656,6 +656,7 @@ def create_vms_by_name(names) 'attributes' => (Vm.attribute_names - Vm.virtual_attribute_names).sort.as_json, 'virtual_attributes' => Vm.virtual_attribute_names.sort.as_json, 'relationships' => (Vm.reflections.keys | Vm.virtual_reflections.keys.collect(&:to_s)).sort, + 'subcollections' => Array(Api::ApiConfig.collections[:vms].subcollections).collect(&:to_s).sort, 'data' => {} } run_options(vms_url)