Ternary operator

In my rhtml file I have tried

<% @problem.reproducible ? "Yes" : "No" %> reproducible is a boolean field.The above not working And i checked <% @problem.reproducible ? puts("Yes") : puts("No") %> Now I get required result on console So how to print it on screen

Thanks in advance

start it with


to indicate it will be output in the view.

On Wed, Aug 20, 2008 at 11:33 AM, Sijo Kg

On 20 Aug 2008, at 11:33, Sijo Kg wrote:

In my rhtml file I have tried

<% @problem.reproducible ? "Yes" : "No" %>

Beginner’s mistake:

<%= @problem.reproducible ? “Yes” : “No” %>

To show something on your page, you need the “=”

Best regards

Peter De Berdt

O sorry

On 20 Aug 2008, at 10:33, Sijo Kg wrote:

You need to use <%= instead of <% if you want the result to be
inserted in the page.