def parent_link
      link = {}
      if collection_hierarchy.length > 1
        parent_name = collection_hierarchy[-2].class.name.downcase
        link[parent_name] = {
          href: @controller.polymorphic_url(collection_hierarchy[0..-2])
        }
      end
      link
    end
def parent_link
      link = {}
      if collection_hierarchy.length > 1
        parent_name = collection_hierarchy[-2].class.name.downcase
        link[parent_name] = {
          href: @controller.polymorphic_url(collection_hierarchy[0..-2])
        }
      end
      link
    end
def parent_link link = { } if collection_hierarchy . length > 1 parent_name = collection_hierarchy [ - 2 ] . class . name . downcase link [ parent_name ] = { href : @controller . polymorphic_url ( collection_hierarchy [ 0 .. - 2 ] ) } end link end
Internal: Returns a Hash with a link to the parent of the collection, if
 it exists, or an empty Hash otherwise.
Internal : Returns a Hash with a link to the parent of the collection if it exists or an empty Hash otherwise .