From: Stefan Rusterholz Date: 2007-08-26T07:27:54+09:00 Subject: Re: How can I make this if/else more succinct? eggie5 wrote: > How can I make this if/else more succinct? > > Video.find(:all).each do |video| > if video._3gp > ext=".3gp" > elsif video._3g2 > ext=".3g2" > elsif video.mp4 > ext=".mp4" > end If I see that correctly you have a database with a table with the 3 fields "_3gp", "_3g2" and "mp4". If that's incorrect, don't bother to read on. If it is correct: why? It seems much saner to have a field 'type' with an enum '3gp','3g2','mp4' NOT NULL. That way you can create your extension simply by prefixing a dot. Regards Stefan -- Posted via http://www.ruby-forum.com/.