server/lib/cimi/models/resource.rb
# Apply the $select options to all sub-collections and prepare then
# to serialize by setting correct :href and :id attributes.
#
Apply the $select options to all sub-collections and prepare then
to serialize by setting correct :href and :id attributes.
Apply the $select options to all sub - collections and prepare then to serialize by setting correct : href and : id attributes .
def prepare
        self.class.schema.collections.map { |coll| coll.name }.each do |n|
          next if self[n].nil?
          next if self[n].kind_of? Array
          if @select_attrs.empty? or @select_attrs.include?(n)
            if n.to_s =~ /config/
              fixed_name = (n.to_s.singularize + "uration").pluralize
              self[n].href = "#{self.base_id}/#{fixed_name}" if !self[n].href
              self[n].id = "#{self.base_id}/#{fixed_name}" if !self[n].entries.empty?
            else
              self[n].href = "#{self.base_id}/#{n}" if !self[n].href
              self[n].id = "#{self.base_id}/#{n}" if !self[n].entries.empty?
            end
            self[n].href["cloudEntryPoint/"] = "" \
              if self[n].href and self[n].href.include? "cloudEntryPoint/"
            self[n].id["cloudEntryPoint/"] = "" \
              if self[n].id and self[n].id.include? "cloudEntryPoint/"
          else
            self[n] = nil
          end
        end
      end
def prepare self . class . schema . collections . map { | coll | coll . name } . each do | n | next if self [ n ] . nil? next if self [ n ] . kind_of? Array if @select_attrs . empty? or @select_attrs . include? ( n ) if n . to_s =~ / config / fixed_name = ( n . to_s . singularize + "uration" ) . pluralize self [ n ] . href = "#{self.base_id}/#{fixed_name}" if ! self [ n ] . href self [ n ] . id = "#{self.base_id}/#{fixed_name}" if ! self [ n ] . entries . empty? else self [ n ] . href = "#{self.base_id}/#{n}" if ! self [ n ] . href self [ n ] . id = "#{self.base_id}/#{n}" if ! self [ n ] . entries . empty? end self [ n ] . href [ "cloudEntryPoint/" ] = "" if self [ n ] . href and self [ n ] . href . include? "cloudEntryPoint/" self [ n ] . id [ "cloudEntryPoint/" ] = "" if self [ n ] . id and self [ n ] . id . include? "cloudEntryPoint/" else self [ n ] = nil end end end
Apply the $select options to all sub-collections and prepare then
to serialize by setting correct :href and :id attributes.
Apply the $select options to all sub - collections and prepare then to serialize by setting correct : href and : id attributes .