-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I've a Rails model set up with Mongoid::Versioning.
class Post
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Versioning
field :name, type: String
end
I want to delete a specific older version. For eg.
post = Post.create name: 'A'
post.update_attributes name: 'B'
post.update_attributes name: 'C'
post.version #=> 3
post.versions.count #=> 2
first_version = post.versions.first #=> #<Post _id: , created_at: _, updated_at: _, version: 2, name: "B">
I want to delete first_version, but when I try to delete it..
first_version.delete
post.versions.count #=> 1
post.reload
post.versions.count #=> 0
..all versions get deleted.
I've tried using destroy instead, tried running the code inside a block passed to post.versionless, to no avail. This definitely looks like a bug. Am I doing something wrong?
Metadata
Metadata
Assignees
Labels
No labels