例如,我更改了 Post 对象的值,但它没有通过验证:
my_post = Post.last
my_post.name
# => "foobar"
my_post.name = "something wrong"
my_post.save
# => (0.1ms) begin transaction
# => (0.0ms) rollback transaction
# => false
my_post.name
# => "something wrong"
实际值仍然是“foobar”,但我现在如何在不创建新对象的情况下返回它?