eggie5 wrote:
> 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


  (params[:categories]||[]).each do |id|
    @subscriber.subscriptions.create :category_id => id,
      :timestamp_start => Time.now.to_s, :is_subscribed => true
  end

best,
Dan
-- 
Posted via http://www.ruby-forum.com/.