I have a claim model representing a medical claim. It has some 130
fields. In one screen, the only option is to update 3 of those
fields, status, discount_amount, payout_amount. It seems that if I:
that it will begin to complain field by field of missing values that
I did not select.
Do I have to select * in order to update only three attributes? I
could write a method that updates those three via SQL, but what then
when I move to a general update screen that updates around 40 of
those attributes?
ActiveRecord works at the row level, meaning, even if you just want to
change a few fields, the whole record still gets saved, not just the
fields you changed.
if you need your AR objects to be aware of changes possibly made by
others, look into the following plugins:
acts_as_versioned
acts_as_modified
also, there is another plugin, acts_as_changed, which appears to only
update those attributes that have changed, and not the entire record.
Chris
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.