Sha256: 8f3a9b8776a385009dac647bbdde5bb4ca28cf6e937c9b5db542c14e060a98a0
Contents?: true
Size: 1.12 KB
Versions: 27
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true # encoding: utf-8 module Mongoid module Errors # Raised when trying to set a polymorphic "references in" association to a # model with multiple "references many/one" associations pointing to that # first model. # # @example Invalid setting of a polymorphic association. # class Face # include Mongoid::Document # # has_one :left_eye, class_name: "Eye", as: :eyeable # has_one :right_eye, class_name: "Eye", as: :eyeable # end # # class Eye # include Mongoid::Document # # belongs_to :eyeable, polymorphic: true # end # # eye = Eye.new # face = Face.new # eye.eyeable = face # Raises error class InvalidSetPolymorphicRelation < MongoidError # Create the new invalid set polymorphic association error. # # @example Create the error. # InvalidSetPolymorphicRelation.new def initialize(name, klass, other_klass) super(compose_message("invalid_set_polymorphic_relation", { name: name, klass: klass, other_klass: other_klass })) end end end end
Version data entries
27 entries across 27 versions & 2 rubygems