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
-~----------~----~----~----~------~----~------~--~---

Reply via email to