I can understand what that code is doing because I know the context, but otherwise I'd be lost.
What does the "? a : b" bit actually do? I've never seen the colon operator. On Mar 3, 2009, at 14:02, Jordan Fowler <[email protected]> wrote: > I would probably just use tertiary as the argument to render: > > render a.exists? ? a : b > > -Jordan > > On Mar 3, 2009, at 12:59 PM, Guyren G Howe wrote: > >> >> What's the most elegant way to do: >> >> if a exists >> render a >> else >> render b >> end >> >> ? >> >> I was going to write a helper that just relies on the exception, >> but I >> wondered if there was already a concise way to do this. >> >> >> > > > > --------------------------------------------------------------- > > Jordan A. Fowler > 2928 Fir St. > San Diego, CA 92102 > E-mail: [email protected] > Website: http://www.jordanfowler.com > Phone: (619) 339-6752 > > > > --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---
