rom-rb/rom-http

View on GitHub
lib/rom/http/associations/many_to_one.rb

Summary

Maintainability
A
15 mins
Test Coverage
# frozen_string_literal: true

require "rom/associations/many_to_one"

module ROM
  module HTTP
    module Associations
      # ManyToOne implementation
      class ManyToOne < ROM::Associations::ManyToOne
        def call(target: self.target)
          raise MissingAssociationViewError, "must override view" unless view

          schema = target.schema.qualified
          relation = target
          apply_view(schema, relation)
        end
      end
    end
  end
end