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

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

Instance Method Summary collapse

Instance Method Details

#buildObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/active_resource/associations/builder/belongs_to.rb', line 9

def build
  validate_options
  embed = options.delete(:embed)

  reflection = model.create_reflection(self.class.macro, name, options)
  model.defines_belongs_to_finder_method(reflection)
  model.defines_belongs_to_embed(reflection)

  reflection
end