Module: ActiveEntity::Identity

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_entity/identity.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#to_keyObject

For ActiveModel::Conversion



22
23
24
25
26
27
28
# File 'lib/active_entity/identity.rb', line 22

def to_key
  if respond_to?(:persisted?) && persisted?
    identity_attributes.empty? ? nil : identity_attributes.map {|name| public_send(name) }
  else
    nil
  end
end