Module: ActiveRemote::ScopeKeys::ClassMethods

Defined in:
lib/active_remote/scope_keys.rb

Instance Method Summary collapse

Instance Method Details

#scope_key(*keys) ⇒ Object

Allows you to define, at a class level, what keys should be used as identifiers when making remote calls. For instance,

class Tag < ActiveRemote::Base

scope_key :user_guid

end

When #scope_keys is called on Tag, it will return the primary key in addition to :user_guid as the scope keys.



25
26
27
# File 'lib/active_remote/scope_keys.rb', line 25

def scope_key(*keys)
  self._scope_keys += keys.map(&:to_s)
end

#scope_keysObject

Used to define what keys are required when making remote persistence or refresh calls.



33
34
35
# File 'lib/active_remote/scope_keys.rb', line 33

def scope_keys
  [ primary_key.to_s ] + _scope_keys
end