From: Eivind Eklund Date: 2007-02-08T22:58:20+09:00 Subject: Re: DRY or not ... On 2/8/07, Josselin wrote: > as a new(ru)bie I always wonder when trying to DRY such code is good or > not and why it should be (I don't like a lot the if.. else.. elsif... > but sometimes it seems better for readiness... vs performances (less > code..) > > If I should DRY it , any tip ? > if params[:new_title].blank? > params[:new_title] = nil > elsif params[:new_title] == "null" > params[:new_title] = "" > end Seems to me like this should likely be an object, with object.new_title being something like @title.blank? ? nil : (@title == "null" ? "" : @title) Though I also agree with Devin Mullins that the problem is likely to be elsewhere (in overall structure). Eivind.