shortcut for ternary operation in views

Hi,

I attended a recent Rails Edge conference and seem to recall a new built-in shortcut to the following, frequently used, code: <%= foo.nil? ? '' : foo %>

Does anyone know what that might be?

Thanks, Mark

Well, it's nothing new:

<%= "#{foo}" %>

Since nil.to_s is an empty string and string interpolation does a .to_s

<%= foo.to_s %>

also works.

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com

Hi --