hummingbird-me/kitsu-server

View on GitHub
app/models/concerns/retrieve_media.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module RetrieveMedia
  extend ActiveSupport::Concern

  included do
    before_validation do
      self.media = retrieve_media
    end
  end

  def retrieve_media
    anime.presence || manga.presence || drama.presence
  end
end