hummingbird-me/kitsu-server

View on GitHub
app/indices/algolia_characters_index.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class AlgoliaCharactersIndex < BaseIndex
  self.index_name = 'characters'

  # Names & Bio
  attributes :names, :canonical_name, :other_names, :description

  # Display Only
  attribute :slug
  attribute :image, format: ShrineAttachmentValueFormatter, method: :image_attacher

  has_many :media, via: 'media_characters.media', as: :canonical_title, polymorphic: true
  has_one :primary_media, via: 'primary_media', as: :canonical_title, polymorphic: true
end