Sha256: b5e83890254245fae7a395c088b5320c4677b58616bb09a30fd7974634ce9803

Contents?: true

Size: 927 Bytes

Versions: 193

Compression:

Stored size: 927 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc
  module Errors #:nodoc

    # This error is raised when trying to reference an embedded document from
    # a document in another collection that is not it's parent.
    #
    # @example An illegal reference to an embedded document.
    #   class Post
    #     include Mongoid::Document
    #     references_many :addresses
    #   end
    #
    #   class Address
    #     include Mongoid::Document
    #     embedded_in :person
    #     referenced_in :post
    #   end
    #
    # @since 2.0.0
    class MixedRelations < MongoidError

      attr_reader :root_klass, :embedded_klass

      def initialize(root_klass, embedded_klass)
        @root_klass, @embedded_klass = root_klass, embedded_klass

        super(
          translate(
            "mixed_relations",
            { :root => root_klass, :embedded => embedded_klass }
          )
        )
      end
    end
  end
end

Version data entries

193 entries across 101 versions & 5 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.5 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.5 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.4 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.4 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.4 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.3 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.3 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.3 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/errors/mixed_relations.rb
mongoid-2.8.1 lib/mongoid/errors/mixed_relations.rb
mongoid-2.8.0 lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.2 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.2 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.2 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.1 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.1 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.1 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.0 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.0 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/errors/mixed_relations.rb
classiccms-0.7.0 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/errors/mixed_relations.rb