Setting param attribute explicitly, not updating with update_attributes call
My controller calls this model method on update:
def update_standard(param_attributes)
...
if param_attributes[:is_legacy] == true
param_attributes[:foo_type_id] = 2
end
update_attributes(param_attributes)
end
foo_type_id should overwrite whatever the user entered in the form, but
the user's choice is what is written to the DB. How can I enforce
foo_type_id being 2 when is_legacy is true?
No comments:
Post a Comment