Reputation: 14701
I changed some value of an entity from the db, but now I want to discard all the changes. How can I do this?
I tried following:
u = User.find(1)
u.nick = "dddd"
u.abandon? #i didn't want rollback the chage of the u
Upvotes: 0
Views: 47
Reputation: 151126
if you don't save it (by using u.save
), then it is not made into the persistent storage. You can just do u = User.find(1)
again to reload the value from the db.
Upvotes: 1