module CouchRestAdapter::DocumentManagement

Constants

UUID_DOC

Public Class Methods

included(base) click to toggle source
# File lib/couch_rest_adapter/document_management.rb, line 20
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

_set_id_and_namespace() click to toggle source
# File lib/couch_rest_adapter/document_management.rb, line 41
def _set_id_and_namespace
  self['_id'] = set_id if self['_id'].blank?
  self['_id'] = self['_id'].namespace_me self.class.namespace
end
query(opts = {}) click to toggle source
# File lib/couch_rest_adapter/document_management.rb, line 37
def query opts = {}
  CGI.unescape(opts.to_query)
end
set_id() click to toggle source

override this method if you want to set your own id

# File lib/couch_rest_adapter/document_management.rb, line 27
def set_id
  uuids.first
end
uuids(opts = {}) click to toggle source
# File lib/couch_rest_adapter/document_management.rb, line 31
def uuids opts = {}
  uuid_doc = File.join UUID_DOC, query(opts)
  uuids_path = File.join CouchRestAdapter::Base.base_path, uuid_doc
  CouchRest.get( uuids_path )["uuids"]
end