Hi all,
I've just started with Merb and I have a little question. I've got
this class and I want it to re-generate the checksum (and some six
other attributes) if the path attribute has changed.
I've now got this:
before :save do
if self.attribute_dirty?(:path)
self.checksum = nil
self.checksum
end
end
def checksum
@checksum ||= self.calculate_checksum if not self.path.nil?
end
Is there an easier better way to do this? I don't like the :
self.checksum = nil
self.checksum
part. Because there are some more attributes that need to do the same.
So it quickly becomes a mess then.
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---