Method: Og::Entity.resolve_primary_key

Defined in:
lib/og/entity.rb

.resolve_primary_key(klass) ⇒ Object



705
706
707
708
709
710
711
712
713
714
715
716
717
718
# File 'lib/og/entity.rb', line 705

def resolve_primary_key(klass)
  # Search the properties, try to find one annotated as primary_key.

  for a in klass.attributes
    anno = klass.ann(a)
    if anno.primary_key?
      return a
    end
  end

  # The default primary key is oid.

  return :oid
end