Module: RPCMapper::Associations::External::ClassMethods

Defined in:
lib/rpc_mapper/associations/external.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to(id, options = {}) ⇒ Object



9
10
11
# File 'lib/rpc_mapper/associations/external.rb', line 9

def belongs_to(id, options={})
  create_external_association RPCMapper::Association::BelongsTo.new(self, id, options)
end

#has_many(id, options = {}) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/rpc_mapper/associations/external.rb', line 17

def has_many(id, options={})
  klass = if options.include?(:through)
    RPCMapper::Association::HasManyThrough
  else
    RPCMapper::Association::HasMany
  end
  create_external_association klass.new(self, id, options)
end

#has_one(id, options = {}) ⇒ Object



13
14
15
# File 'lib/rpc_mapper/associations/external.rb', line 13

def has_one(id, options={})
  create_external_association RPCMapper::Association::HasOne.new(self, id, options)
end