I use datamapper for the database. I have a table.
class ZedTable
include DataMapper::Resource
property :id, Serial
property :label, String
property :now, Boolean, :default => false
before :save do
ZedTable.all.update(:now => false)
self.now = true
end
end
That is, I want only one value was true
. But when I save the data I get an error.
Failure/Error: Unable to find matching line from backtrace
SystemStackError:
stack level too deep
Why? And how do I solve this problem? Thanks.