Sha256: 70fe07bc44677e21fbdbb07c6f744276848fb0dee8eece610c039f677c4b05f6
Contents?: true
Size: 983 Bytes
Versions: 16
Compression:
Stored size: 983 Bytes
Contents
module Mongoid #:nodoc: module Associations #:nodoc: class Accessor #:nodoc: class << self # Gets an association, based on the type provided and # passes the name and document into the newly instantiated # association. def get(type, document, options) document ? type.new(document, options) : nil end # Set an object association. This is used to set the parent reference # in a +BelongsTo+, a child reference in a +HasOne+, or many child # references in a +HasMany+. # # Options: # # type: The association type # name: The name of the association # document: The base document to handle the access for. # object: The object that was passed in to the setter method. # options: optional options. def set(type, document, object, options) type.update(object, document, options) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems