Class: NoBrainer::Document::Association::HasOne
- Defined in:
- lib/no_brainer/document/association/has_one.rb
Defined Under Namespace
Classes: Metadata
Instance Method Summary collapse
Methods inherited from HasMany
#before_destroy_callback, #dependent_criteria, #loaded?, #preload, #set_inverse_proc, #set_inverses_of, #target_criteria, #write
Methods included from Core
#assert_target_type, #initialize
Instance Method Details
#read ⇒ Object
12 13 14 15 16 |
# File 'lib/no_brainer/document/association/has_one.rb', line 12 def read targets = target_criteria.to_a # to load the cache NoBrainer.logger.warn "#{owner} has more than one #{target_name}" if targets.size > 1 targets.first end |