Sha256: fe2bf7a62bf6ac148f5009058403314a6a18702b955e1a1b9ae3f2fa37331cad
Contents?: true
Size: 956 Bytes
Versions: 21
Compression:
Stored size: 956 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Rails class ActiveRecordAssociationAdapter attr_reader :klass, :macro, :name, :options def self.for_association(association) macro = case association when MongoMapper::Plugins::Associations::BelongsToAssociation :belongs_to when MongoMapper::Plugins::Associations::ManyAssociation :has_many when MongoMapper::Plugins::Associations::OneAssociation :has_one else raise "no #{name} for association of type #{association.class}" end new(association, macro) end def initialize(association, macro) @klass, @name = association.klass, association.name # only include compatible options @options = association.options.slice(:conditions, :order) @macro = macro end end end end end
Version data entries
21 entries across 21 versions & 3 rubygems