Method: Elastictastic::ParentChild#_parent
- Defined in:
- lib/elastictastic/parent_child.rb
#_parent ⇒ Object
:nodoc:
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/elastictastic/parent_child.rb', line 60 def _parent #:nodoc: return @_parent if defined? @_parent @_parent = if @_parent_id self.class.parent_association.clazz.in_index(index).find(@_parent_id) end #TODO - here's a piece of debugging to fix a problem where we get weird parents. remove after fixing if @_parent && !@_parent.respond_to?(:id) raise ArgumentError.new("Bad parent loaded from id #{@_parent_id} is a #{@_parent.class.name}.") end @_parent end |