[Rails] Re: help with some ugly code: refactoring

2012-01-05 Thread Max
thanks guys, between the two of you I got it nailed! Max On Jan 5, 11:19 am, M Daubs wrote: > Here is my suggestion. > > Have your User model ignore attempts to set a blank password: > > def password=(value) >   super(value) unless value.empty? > end > > And then change your controller to: > > i

[Rails] Re: help with some ugly code: refactoring

2012-01-05 Thread M Daubs
Here is my suggestion. Have your User model ignore attempts to set a blank password: def password=(value) super(value) unless value.empty? end And then change your controller to: if @user.update_attributes(params[:user]) flash[:success] = "Profile updated." redirect_to @user else flash[