app/serializers/spotlight/exhibit_export_serializer.rb in blacklight-spotlight-0.1.0 vs app/serializers/spotlight/exhibit_export_serializer.rb in blacklight-spotlight-0.2.0
- old
+ new
@@ -23,16 +23,26 @@
keys = super
keys += [:solr_document_id]
end
end
+ class TaggingSerializer < Spotlight::ExportSerializer(ActsAsTaggableOn::Tagging)
+ has_one :tag, root: 'tag_attributes', serializer: Spotlight.ExportSerializer(ActsAsTaggableOn::Tag)
+ def filter keys
+ keys = super
+ keys -= [:tagger_type]
+ keys -= [:context] # context conflicts with ActiveRecord methods; fortunately, we only have the default context
+ keys += [:taggable_id]
+ end
+ end
+
class ExhibitExportSerializer < Spotlight::ExportSerializer(Spotlight::Exhibit)
self.root = false
def filter keys
keys = super
- keys = keys - [:slug, :name]
+ keys = keys - [:slug, :name, :default]
end
def feature_pages
object.feature_pages.at_top_level
end
@@ -45,11 +55,13 @@
has_many :contacts, root: 'contacts_attributes', serializer: Spotlight.ExportSerializer(Spotlight::Contact)
has_many :contact_emails, root: 'contact_emails_attributes', serializer: Spotlight.ExportSerializer(Spotlight::ContactEmail)
has_one :blacklight_configuration, root: 'blacklight_configuration_attributes', serializer: Spotlight.ExportSerializer(Spotlight::BlacklightConfiguration)
has_many :solr_document_sidecars, root: 'solr_document_sidecars_attributes', serializer: Spotlight::SolrDocumentSerializer
-
+ has_many :owned_taggings, root: 'owned_taggings_attributes', serializer: Spotlight::TaggingSerializer
# todo: include attachment binary paylod??
has_many :attachments, root: 'attachments_attributes', serializer: Spotlight.ExportSerializer(Spotlight::Attachment)
+
+ has_many :resources, root: 'resources_attributes', serializer: Spotlight.ExportSerializer(Spotlight::Resource)
end
end