Rails - before_save that includes updated object
Posted
by Sam
on Stack Overflow
See other posts from Stack Overflow
or by Sam
Published on 2010-05-05T08:25:04Z
Indexed on
2010/05/05
8:58 UTC
Read the original article
Hit count: 176
ruby-on-rails
|callback
I have a before_save that calculates a percentage that needs to include the object that is being updated. Is there a one-liner in Rails that takes care of this?
for example and this is totally made up:
Object.find(:all, :include => :updated_object)
Currently I'm sending the object that is getting updated to the definition that calculates the percentage and that works but it's making things messy.
© Stack Overflow or respective owner