class MarkMapper::Plugins::Rails::ActiveRecordAssociationAdapter

Attributes

klass[R]
macro[R]
name[R]
options[R]

Public Class Methods

for_association(association) click to toggle source
# File lib/mark_mapper/plugins/rails/active_record_association_adapter.rb, line 8
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
new(association, macro) click to toggle source
# File lib/mark_mapper/plugins/rails/active_record_association_adapter.rb, line 23
def initialize(association, macro)
  @klass, @name = association.klass, association.name
  # only include compatible options
  @options = association.options.slice(:conditions, :order)

  @macro = macro
end