class LabSerializer < ActiveModel::Serializer

  # cached

  attributes :id,
    :name,
    :kind_name,
    :parent_id,
    :blurb,
    :description,
    :slug,
    :avatar_url,
    :header_url,
    :address_1,
    :address_2,
    :city,
    :county,
    :postal_code,
    :country_code,
    :latitude,
    :longitude,
    :address_notes,
    :phone,
    :email,
    :capabilities,
    :url
    # :links,
    # :employees
    # links_attributes: [ :id, :link_id, :url, '_destroy' ],
    # employees_attributes: [ :id, :job_title, :description ]

  has_many :links

  def kind_name
    kind
  end

  def url
    lab_url(object)
  end

  def avatar_url
    if object.avatar_uid.present?
      Dragonfly.app.remote_url_for(object.avatar_uid)
    end
  end

  def header_url
    if object.header.present?
      Dragonfly.app.remote_url_for(object.header_uid)
    end
  end

  # def cache_key
  #   # object
  #   # [object, scope]
  # end

end

class LabSerializer < ActiveModel::Serializer

  # cached

  attributes :id,
    :name,
    #:kind_name,
    :parent_id,
    :blurb,
    :description,
    :slug,
    :avatar_url,
    :header_url,
    :address_1,
    :address_2,
    :city,
    :county,
    :postal_code,
    :country_code,
    :latitude,
    :longitude,
    :address_notes,
    :phone,
    :email,
    :capabilities
    #:url
    # :links,
    # :employees
    # links_attributes: [ :id, :link_id, :url, '_destroy' ],
    # employees_attributes: [ :id, :job_title, :description ]

  has_many :links

  # TODO: kind_name is breaking labs.json endpoint. Temporary comment out
  def kind_name
    kind
  end

  def url
    lab_url(object)
  end

  def avatar_url
    if object.avatar_uid.present?
      Dragonfly.app.remote_url_for(object.avatar_uid)
    end
  end

  def header_url
    if object.header.present?
      Dragonfly.app.remote_url_for(object.header_uid)
    end
  end

  # def cache_key
  #   # object
  #   # [object, scope]
  # end

end

--- 
+++ 
@@ -4,7 +4,7 @@
 
   attributes :id,
     :name,
-    #:kind_name,
+    :kind_name,
     :parent_id,
     :blurb,
     :description,
@@ -22,8 +22,8 @@
     :address_notes,
     :phone,
     :email,
-    :capabilities
-    #:url
+    :capabilities,
+    :url
     # :links,
     # :employees
     # links_attributes: [ :id, :link_id, :url, '_destroy' ],
@@ -31,7 +31,6 @@
 
   has_many :links
 
-  # TODO: kind_name is breaking labs.json endpoint. Temporary comment out
   def kind_name
     kind
   end
Revert "labs.json errors when calling kind_name and url"

This reverts commit 961b6588ddaf82f7c475652a30b022fcfaa63fb0.
