Class: ActiveResource::Associations::Builder::HasOne

Inherits:
Association
  • Object
show all
Defined in:
lib/active_resource/associations/builder/has_one.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



5
6
7
8
9
10
# File 'lib/active_resource/associations/builder/has_one.rb', line 5

def build
  validate_options
  model.create_reflection(self.class.macro, name, options).tap do |reflection|
    model.defines_has_one_finder_method(reflection.name, reflection.klass)
  end
end