Class: ActiveRecord::Associations::Builder::HasOne

Inherits:
SingularAssociation show all
Defined in:
lib/active_record/associations/builder/has_one.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#model, #name, #options, #reflection

Instance Method Summary collapse

Methods inherited from SingularAssociation

#define_accessors

Methods inherited from Association

build, #initialize, #mixin

Constructor Details

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

Instance Method Details

#buildObject



16
17
18
19
20
# File 'lib/active_record/associations/builder/has_one.rb', line 16

def build
  reflection = super
  configure_dependency unless options[:through]
  reflection
end

#constructable?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/active_record/associations/builder/has_one.rb', line 12

def constructable?
  !options[:through]
end