Class: Superstore::Associations::HasOne

Inherits:
Association show all
Defined in:
lib/superstore/associations/has_one.rb

Instance Attribute Summary

Attributes inherited from Association

#owner, #reflection

Instance Method Summary collapse

Methods inherited from Association

#association_class, #association_class_name, #initialize, #loaded!, #loaded?, #target, #target=

Constructor Details

This class inherits a constructor from Superstore::Associations::Association

Instance Method Details

#readerObject



4
5
6
7
8
9
10
# File 'lib/superstore/associations/has_one.rb', line 4

def reader
  unless loaded?
    self.target = load_target
  end

  target
end

#writer(record) ⇒ Object



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

def writer(record)
  self.target = record
end