Hi,
I have numerous statements like these in both my create and update action of my controller:
@company.set_preference(:api_username, params[:company]['api_username']) if params[:company]['api_username']
@company.set_preference(:api_password, params[:company]['api_password']) if params[:company]['api_password']
I'm wondering if how I can refactor these to make my code more dry. I'm acutely aware they may belong in the model (re: fat models and skinny controllers), but am not sure what to do. Can someone enlighten me?
Thanks in advance for your time,
Gav