app/controllers/api_controller/renderer.rb
#
# Helper proc for rendering a collection of type specified.
#
Helper proc for rendering a collection of type specified.
Helper proc for rendering a collection of type specified .
def render_collection_type(type, id, is_subcollection = false)
      klass = collection_class(type)
      opts  = {
        :name               => type.to_s,
        :is_subcollection   => is_subcollection,
        :resource_actions   => "resource_actions_#{type}",
        :collection_actions => "collection_actions_#{type}"
      }
      if id
        render_resource type, resource_search(id, type, klass), opts
      else
        opts[:count]            = klass.count
        opts[:expand_resources] = expand?(:resources)
        res = collection_search(is_subcollection, type, klass)
        opts[:subcount] = res.length
        render_collection type, res, opts
      end
    end
def render_collection_type ( type , id , is_subcollection = false ) klass = collection_class ( type ) opts = { :name => type . to_s , :is_subcollection => is_subcollection , :resource_actions => "resource_actions_#{type}" , :collection_actions => "collection_actions_#{type}" } if id render_resource type , resource_search ( id , type , klass ) , opts else opts [ :count ] = klass . count opts [ :expand_resources ] = expand? ( :resources ) res = collection_search ( is_subcollection , type , klass ) opts [ :subcount ] = res . length render_collection type , res , opts end end
Helper proc for rendering a collection of type specified.
Helper proc for rendering a collection of type specified .
type
<not_specific>
id
<not_specific>
is_subcollection
<not_specific>