Hi,

I wanted to check values before being saved, for example like this:

    myobject.qty = 5
    myobject.save

    class ObjectClass
        include DataMapper::Resource
        before :save, :fix_qty

        def fix_qty
            if self.dirty.qty > self.qty
                # do something
            end
        end
    end

"self.dirty.qty" should have the new assigned value, and "self.qty"
the value from database

How should I do that?

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to