hummingbird-me/kitsu-server

View on GitHub
app/resources/media_production_resource.rb

Summary

Maintainability
A
0 mins
Test Coverage
C
75%
class MediaProductionResource < BaseResource
  immutable
  attribute :role

  has_one :media, polymorphic: true
  has_one :company

  filter :role, apply: ->(records, values, _opts) {
    values = values.map { |v| records.roles[v] || v }
    records.where(roles: values)
  }
end