Reputation: 21621
here's the Activities model
class Activity < ActiveRecord::Base
belongs_to :user
attr_accessible :week, :day, :bcalor, :bicycl, :ccalor, :foodid, :jog,
:lunges, :pushups, :situps, :squats
end
I'd like to add functionality, such as, after I save or update a activity, I be able to update the summary all the acitities. In .NET we have stuff like OnModelUpdating and OnModelUpdated. How do I accomplish the samething using activerecord?
Thanks for helping
Upvotes: 0
Views: 38
Reputation: 9691
In Rails, they are called callbacks. Here you go: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
Upvotes: 1