I have a user table, and it has forty columns, including name, gender,
address, email, phone…
So my @user object will have forty attributes.
I divide these attributes into 4 groups… namely ‘general info’,
‘personal info’, ‘contact info’… and I make separate forms to edit
these 4 different group attributes.
The problem is when I update one group of attributes using:
@user.update_attributes(params[:user])
now, because the params[:user] hash only contains partial attributes
that @user has, so this can’t work.
now, i use
@user.update_attribute(:address, params[:user][:address])
@user.update_attribute(:city, params[:user][:city])
@user.update_attribute(:state, params[:user][:state])
@user.update_attribute(:zip_code, params[:user][:zip_code])
@user.update_attribute(:country, params[:user][:country])
@user.update_attribute(:phone, params[:user][:phone])
@user.update_attribute(:phone_alt, params[:user][:phone_alt])
which seem like a mess.
any other solution?