Sha256: a85f9e6e8768be3991d8b60958586d2e9bd6dd15ca21edf3e81cf377fcad144b
Contents?: true
Size: 1.4 KB
Versions: 27
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true # encoding: utf-8 module Mongoid module Errors # This error is raised in case of an ambigous association. # # @example An ambigous association. # class Person # include Mongoid::Document # # has_many :invitations, inverse_of: :person # has_many :referred_invitations, class_name: "Invitation", inverse_of: :referred_by # end # # class Invitation # include Mongoid::Document # # belongs_to :person # belongs_to :referred_by, class_name: "Person" # end class AmbiguousRelationship < MongoidError # Create the new error. # # @example Create the error. # AmbiguousRelationship.new( # Person, Drug, :person, [ :drugs, :evil_drugs ] # ) # # @param [ Class ] klass The base class. # @param [ Class ] inverse The inverse class. # @param [ Symbol ] name The relation name. # @param [ Array<Symbol> ] candidates The potential inverses. # # @since 3.0.0 def initialize(klass, inverse, name, candidates) super( compose_message( "ambiguous_relationship", { klass: klass, inverse: inverse, name: name.inspect, candidates: candidates.map(&:inspect).join(", ") } ) ) end end end end
Version data entries
27 entries across 27 versions & 2 rubygems