Sha256: 78199b2c353c5ba3b0ad3f79f98da52ee729067300dfc5fa80265557e89a578d
Contents?: true
Size: 952 Bytes
Versions: 6
Compression:
Stored size: 952 Bytes
Contents
# encoding: UTF-8 module MarkMapper module Plugins module Rails class ActiveRecordAssociationAdapter attr_reader :klass, :macro, :name, :options def self.for_association(association) macro = case association when MarkMapper::Plugins::Associations::BelongsToAssociation :belongs_to when MarkMapper::Plugins::Associations::ManyAssociation :has_many when MarkMapper::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
6 entries across 6 versions & 1 rubygems