Class: ActiveRecord::Reflection::EmbedsOneReflection

Inherits:
AssociationReflection show all
Defined in:
lib/active_record/embeds_reflection.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(name, scope, options, active_record) ⇒ EmbedsOneReflection

Returns a new instance of EmbedsOneReflection.



8
9
10
# File 'lib/active_record/embeds_reflection.rb', line 8

def initialize(name, scope, options, active_record)
  super(macro, name, scope, options, active_record)
end

Instance Method Details

#association_class_with_embeds_oneObject



16
17
18
19
20
21
22
# File 'lib/active_record/embeds_reflection.rb', line 16

def association_class_with_embeds_one
  if macro == :embeds_one
    Associations::EmbedsOneAssociation
  else
    association_class_without_embeds_one
  end
end

#embeds_one?Boolean

Returns:

  • (Boolean)


14
# File 'lib/active_record/embeds_reflection.rb', line 14

def embeds_one?; true; end

#macroObject



12
# File 'lib/active_record/embeds_reflection.rb', line 12

def macro; :embeds_one; end