Ternary operator

Hi
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
Sijo

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
Thanks

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.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs