Hi people
I have a doubt.
I have 2 tables (models) "Product" and "Purchase". I want to use the
callback after_create to update the attribute Product.quantity every
time a Purchase is created, so I think this should be work, but I
don't know the right syntax
In purchase model
def after_create
Product.update(product.quantity = product.quantity +
purchase.quantity)
end
can somebody help me with this??
thanks
--
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.