Sha256: ab2d5f5677698ad55020bd1b7c7795d3b8c93a9e79ada3fb07869badefa90bd3

Contents?: true

Size: 554 Bytes

Versions: 13

Compression:

Stored size: 554 Bytes

Contents

module CouchPotato
  module Persistence
    module Revisions
      # returns all available revisions of a document, first to last.
      # causes n+1 requests. do not use in production code.
      def _revisions
        with_revs = database.couchrest_database.get(id, revs: true, revs_info: true)._document
        revs_info = with_revs[:_revs_info]
        revs = revs_info.select {|info| info[:status] == 'available' }.map {|info| info[:rev] }
        revs.reverse.map {|rev| database.couchrest_database.get(id, rev: rev) }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
couch_potato-1.17.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.16.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.15.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.14.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.13.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.12.1 lib/couch_potato/persistence/revisions.rb
couch_potato-1.12.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.11.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.10.1 lib/couch_potato/persistence/revisions.rb
couch_potato-1.10.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.9.0 lib/couch_potato/persistence/revisions.rb
couch_potato-1.7.1 lib/couch_potato/persistence/revisions.rb
couch_potato-1.7.0 lib/couch_potato/persistence/revisions.rb