Module: Sequencescape::Api::Associations::BelongsTo

Defined in:
lib/sequencescape-api/associations/belongs_to.rb

Defined Under Namespace

Classes: AssociationProxy

Instance Method Summary (collapse)

Instance Method Details

- (Object) belongs_to(association, options = {}, &block)



59
60
61
62
63
64
65
66
67
68
# File 'lib/sequencescape-api/associations/belongs_to.rb', line 59

def belongs_to(association, options = {}, &block)
  association = association.to_sym

  proxy = Class.new(AssociationProxy)
  proxy.association = association
  proxy.options     = options
  proxy.instance_eval(&block) if block_given?

  association_methods(association, :belongs_to, proxy)
end