If something needs to be done after create, update and destroy I
believe you need to use both after_save and after_destroy. There are
no single callback that encapsulates all 3.

On Apr 18, 11:15 am, Juan Kinunt <[email protected]> wrote:
> Viorel wrote:
> > I think it is a problem with your model. Tou should not have fields
> > with calculated values, only a method that calculate the value, witch
> > you call when you need that value
>
> Why can't my model have calculated values? Right know, my problem is
> that I have a lot of virtual attributes in order to calculate these
> values when I need them. I use this attributes a lot (the virtual
> attributes are total and tax of invoices that are calculated from the
> lines of the invoices) and the app have efficienty problems. I use this
> attributes for searching, doing statistics, calculate another
> values...so I have decided to store them in the database. Each time a
> line is created, modified or deleted the corresponding invoice is
> updated. What do you think about this implementation?
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to