From: David Masover Date: 2011-08-29T12:04:59+09:00 Subject: Re: Help me understand this code On Sunday, August 28, 2011 06:41:54 AM Josh Cheek wrote: > On Sun, Aug 28, 2011 at 3:08 AM, Chris Root wrote: > > Can anyone explain the syntax for the following code? It worked in rails > > 3.1/1.9.2 but fails to work in 2.3.4/1.8.7. It's defined in a model if > > it pertains. Many thanks. > > > > digital? ? :digital : :real > > > > -- > > Posted via http://www.ruby-forum.com/. > > That's a ternary operator, it works like Stefano said. It isn't broken, > whatever code was using it must be broken. And the way we can figure that out is with an error message. I'm surprised that programmers still do this: "It worked in rails 3.1/1.9.2 but fails to work in 2.3.4/1.8.7." WTF does "worked" and "fails to work" mean in this context? Does it crash? (If so, is there a stacktrace?) Does it do something other than what you expect? Does it cause a unit test to fail? etc etc...