app/controllers/api/base_controller/renderer.rb
#
# Let's expand a subcollection
#
Let's expand a subcollection
Let ' s expand a subcollection
def expand_subcollection(json, sc, sctype, subresources)
        if collection_config.show_as_collection?(sc)
          copts = {
            :counts           => Api::QueryCounts.new(subresources.length),
            :is_subcollection => true,
            :expand_resources => @req.expand?(sc)
          }
          json.set! sc.to_s, collection_to_jbuilder(sc.to_sym, sctype, subresources, copts)
        else
          json.set! sc.to_s do |js|
            subresources.each do |scr|
              if @req.expand?(sc) || scr["id"].nil?
                add_child js, normalize_hash(sctype, scr)
              else
                js.child! { |jsc| jsc.href normalize_href(sctype, ApplicationRecord.compress_id(scr["id"])) }
              end
            end
          end
        end
      end
def expand_subcollection ( json , sc , sctype , subresources ) if collection_config . show_as_collection? ( sc ) copts = { :counts => Api :: QueryCounts . new ( subresources . length ) , :is_subcollection => true , :expand_resources => @req . expand? ( sc ) } json . set! sc . to_s , collection_to_jbuilder ( sc . to_sym , sctype , subresources , copts ) else json . set! sc . to_s do | js | subresources . each do | scr | if @req . expand? ( sc ) || scr [ "id" ] . nil? add_child js , normalize_hash ( sctype , scr ) else js . child! { | jsc | jsc . href normalize_href ( sctype , ApplicationRecord . compress_id ( scr [ "id" ] ) ) } end end end end end
Let's expand a subcollection
Let ' s expand a subcollection
json
<not_specific>
sc
<not_specific>
sctype
<not_specific>
subresources
<not_specific>