Sha256: 4d3427b502b221d84df3c3c1383b14863f2096c988daf563f8a2debb0771ccd2

Contents?: true

Size: 636 Bytes

Versions: 7

Compression:

Stored size: 636 Bytes

Contents

module Mongoid #:nodoc:
  module Associations #:nodoc:
    class BelongsToAssociation #:nodoc:

      # Creates the new association by setting the internal 
      # document as the passed in Document. This should be the
      # parent.
      #
      # All method calls on this object will then be delegated
      # to the internal document itself.
      def initialize(document)
        @document = document.parent
      end

      # All calls to this association will be delegated straight
      # to the encapsulated document.
      def method_missing(method, *args)
        @document.send(method, *args)
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
durran-mongoid-0.2.0 lib/mongoid/associations/belongs_to_association.rb
durran-mongoid-0.2.2 lib/mongoid/associations/belongs_to_association.rb
durran-mongoid-0.2.3 lib/mongoid/associations/belongs_to_association.rb
durran-mongoid-0.2.4 lib/mongoid/associations/belongs_to_association.rb
mongoid-0.2.7 lib/mongoid/associations/belongs_to_association.rb
mongoid-0.2.6 lib/mongoid/associations/belongs_to_association.rb
mongoid-0.2.5 lib/mongoid/associations/belongs_to_association.rb