You can mix in LifecycleCallbacks to the field and override beforeSave there, if you prefer. Someone correct me if I'm wrong, but I think beforeSave is called before it is known if save will fail. And in afterSave I don't know what 'dirty_?' and 'was' are set to. So you may possibly want to create generic trait that uses beforeSave and afterSave together, so beforeSave temporarily stores the relevant history data but only afterSave saves the history. But again, I'm making a bunch of assumptions.
------------------------------------- David Pollak<[email protected]> wrote: MappedField.dirty_? -- was the field changed? MappedField.is -- the current value MappedField.was -- the value pulled from the DB On Tue, Jan 26, 2010 at 1:37 PM, Gang <[email protected]> wrote: > Hi all, > > Somebody please help on this...... > > Before I save the Mapper object back to database, I need to check if > one of the mapped field changed; if changed, I need trigger another > database call(create a new entry in a history table). What is the > best way doing it? Do I have to override MetaMapper's beforeSave() to > query database for changes before save? > > I'm using CRUDifier and its provided "edit" page to submit user > input. Could somebody explain to me what is the life cycle of the > Mapper object after user click on "Edit" button? > > Thanks in advance! > > Gang > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en.
