# File lib/pragma/decorator/association/adapter/poro.rb, line 34 def primary_key associated_object&.id end
class Pragma::Decorator::Association::Adapter::Poro
This is the fallback adapter that is used when no other adpater is compatible with a model. It simply calls #id
on the associated object to get the PK and returns the associated object itself when expanding.
@api private
Public Class Methods
supports?(_bond)
click to toggle source
Returns whether the adapter supports the bond.
Since this is the default adapter, this always returns true
.
@param _bond [Bond] the bond to check
@return [Boolean] always true
# File lib/pragma/decorator/association/adapter/poro.rb, line 23 def supports?(_bond) true end
Public Instance Methods
full_object()
click to toggle source
Returns the expanded associated object.
This adapter simply returns the associated object itself.
@return [Object] the associated object
# File lib/pragma/decorator/association/adapter/poro.rb, line 43 def full_object associated_object end
primary_key()
click to toggle source
Returns the PK of the associated object.
This adapter simply calls #id
on the associated object or returns nil
if there is no associated object.
@return [Integer|String|NilClass] the PK of the associated object