update all records in the db

Hi !

I have some information (a value and a percentage number) saved in the database. for example 5 records. I wrote a model, who's look like as the following model:

I believe what you want is a callback. In your case, it looks like an after save callback will do what you want:

class Percentage < AR::Base   after_save :update_related_models

  protected   def update_related_models     # Do what you need with the other models here. This will only be called     # after this model is saved.   end end

For the full details, http://api.rubyonrails.com/classes/ActiveRecord/Callbacks.html

Hope that helps !

As soon as the record is saved, the callback will fire. You decide what to do in the callback.

Bye !