From: Robert Klemme Date: 2007-08-29T02:35:03+09:00 Subject: Re: can this be more succinct? On 28.08.2007 16:09, Bertram Scharpf wrote: > Hi, > > Am Dienstag, 28. Aug 2007, 23:00:08 +0900 schrieb eggie5: >> How can this be more succinct? Can I somehow put the nil check inline >> with the each? >> >> unless(params[:categories].nil?) >> params[:categories].each do |id| >> @subscriber.subscriptions.create :category_id => >> id, :timestamp_start => Time.now.to_s, :is_subscribed => true >> end >> end > > Maybe: > > pc = params[:categories] > pc and pc.each do |id| > ... > end +1 robert