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

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

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#name, #options, #scope

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SingularAssociation

define_accessors, define_constructors

Methods inherited from Association

build, #build, create_builder, define_accessors, define_callbacks, #define_extensions, define_readers, define_writers, #initialize, #validate_options

Constructor Details

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

Class Method Details

.valid_dependent_optionsObject



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

def self.valid_dependent_options
  [:destroy, :delete, :nullify, :restrict_with_error, :restrict_with_exception]
end

Instance Method Details

#macroObject



3
4
5
# File 'activerecord/lib/active_record/associations/builder/has_one.rb', line 3

def macro
  :has_one
end

#valid_optionsObject



7
8
9
10
11
# File 'activerecord/lib/active_record/associations/builder/has_one.rb', line 7

def valid_options
  valid = super + [:order, :as]
  valid += [:through, :source, :source_type] if options[:through]
  valid
end