Module: CouchPotato::Persistence::Revisions
- Defined in:
- lib/couch_potato/persistence/revisions.rb
Instance Method Summary collapse
-
#_revisions ⇒ Object
returns all available revisions of a document, first to last.
Instance Method Details
#_revisions ⇒ Object
returns all available revisions of a document, first to last. causes n+1 requests. do not use in production code.
6 7 8 9 10 11 |
# File 'lib/couch_potato/persistence/revisions.rb', line 6 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 |