Question

Guys I hav below code snippet and I need remove an element from animals array, but I get UpdateConflictError

zoo.animals # => Wolf,Tiger,Lion
zoo.animals.delete("Wolf") # => Tiger, Lion
zoo.update(:animals => zoo.animals)
# => DataMapper::UpdateConflictError: Zoo#update cannot be called on a dirty resource
zoo.update #=> also give me the same error

I have to query the zoo.animals and then remove Wolf but seems not successful. What you recommend? thanks.

P.S: here datamapper has explained about dirty resources but I have no other alternative.

Was it helpful?

Solution

This has resolved the error:

zoo.animals # => Wolf,Tiger,Lion
zoo.animals.delete("Wolf") # => Tiger, Lion
zoo.save
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top