Module: NoBrainer::Document::Association::Core

Extended by:
ActiveSupport::Concern
Included in:
BelongsTo, HasMany, HasManyThrough
Defined in:
lib/no_brainer/document/association/core.rb

Defined Under Namespace

Modules: Metadata

Instance Method Summary collapse

Instance Method Details

#assert_target_type(value) ⇒ Object



72
73
74
75
76
77
# File 'lib/no_brainer/document/association/core.rb', line 72

def assert_target_type(value)
  unless value.is_a?(target_model) || value.nil?
    options = { :attr_name => target_name, :value => value, :type => target_model }
    raise NoBrainer::Error::InvalidType.new(options)
  end
end

#initialize(metadata, owner) ⇒ Object



68
69
70
# File 'lib/no_brainer/document/association/core.rb', line 68

def initialize(, owner)
  @metadata, @owner = , owner
end