aequitas icon indicating copy to clipboard operation
aequitas copied to clipboard

External validator freezes models

Open greyblake opened this issue 12 years ago • 2 comments

External validator freezes resource model

class User
  attr_accessor :name, :age
end

class UserValidator
  include Aequitas
  validates_presence_of :name
end


user = User.new
validator = UserValidator.new(user)

puts validator.valid?  # => false, as expected
user.name = "Tanya"  # => can't modify frozen User (RuntimeError)

So it looks like one model is validated it can't be modified to make it pass validation?

greyblake avatar Dec 28 '12 14:12 greyblake

This is a bug I did not catched since I do not use mutable business objects. Will fix this soon. Thx for reporting!

mbj avatar Dec 28 '12 14:12 mbj

Thanks. The models are frozen with deep_freeze from ice_nine gem.

greyblake avatar Dec 28 '12 15:12 greyblake