Module: ActiveRemote::PrimaryKey::ClassMethods

Defined in:
lib/active_remote/primary_key.rb

Instance Method Summary collapse

Instance Method Details

#default_primary_keyObject

The default_primary_key is used to define what attribute is used as a primary key for your global code base. If you use a primary key other than this, you’ll want to set it using the primary_key method listed below



12
13
14
# File 'lib/active_remote/primary_key.rb', line 12

def default_primary_key
  :guid
end

#primary_key(value = nil) ⇒ Object

In the event that you use a different primary key than the default primary key listed above (like :uuid, or :id), you’ll use this method to change that primary key. This will be used when making remote calls to persist or refresh data.



22
23
24
25
# File 'lib/active_remote/primary_key.rb', line 22

def primary_key(value = nil)
  @primary_key = value if value
  @primary_key || default_primary_key
end