Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locking doesn't work if model has presence validators #13

Closed
dementrock opened this issue Apr 21, 2013 · 2 comments
Closed

Locking doesn't work if model has presence validators #13

dementrock opened this issue Apr 21, 2013 · 2 comments

Comments

@dementrock
Copy link

For example I have the following toy model:

class Toy
  include Mongoid::Document
  include Mongoid::OptimisticLocking
  belongs_to :owner, class_name: 'User'
  validates_presence_of :owner
end

Then even the following code would fail (in rails console)

> a = Toy.create owner: User.first
(reload console)
> Toy.first.save
Mongoid::Errors::StaleDocument: Attempted to update a stale document: Toy
@tomdmaguire
Copy link
Contributor

This should be closed by #14

@burgalon
Copy link
Owner

New version 0.0.4 published to Rubygems. Thank you @tomglue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants