Class: ActiveResource::Associations::Builder::BelongsTo

Inherits:
Association
  • Object
show all
Defined in:
lib/active_resource/associations/builder/belongs_to.rb

Instance Attribute Summary

Attributes inherited from Association

#klass, #model, #name, #options

Instance Method Summary collapse

Methods inherited from Association

build, #initialize

Constructor Details

This class inherits a constructor from ActiveResource::Associations::Builder::Association

Instance Method Details

#buildObject


7
8
9
10
11
12
# File 'lib/active_resource/associations/builder/belongs_to.rb', line 7

def build
  validate_options
  reflection = model.create_reflection(self.class.macro, name, options)
  model.defines_belongs_to_finder_method(reflection.name, reflection.klass, reflection.foreign_key)
  return reflection
end