send(column.name) comparison problems

I am having trouble with what I thought would be a simple equality comparison.

Here is the relevant code:

<% for ticket in @tickets %>   <tr>   <% for column in Ticket.content_columns %>     <% if column.human_name == "Status" %>       <% if ticket.send(column.name).eql?("true") %>         <td>Open</td>       <% else %>         <td>Closed</td>       <% end %>     <% else %>       <td><%=h ticket.send(column.name) %></td>     <% end %>   <% end %>

My problem is as follows:

if ticket.send(column.name).eql?("true") always evaluates to false and prints Closed.

I've also tried: if ticket.send(column.name) == "true" but I get the same behavior.

When I try <%=h ticket.send(column.name) %> it get true

Any help would be most appreciated.

Nevermind my bad. Passing true to eql? in the proper way fixed my problem.

However anyone know why == "true" wouldn't work when the same form works for checking the column name against "Status"?

I am having trouble with what I thought would be a simple equality comparison.

Here is the relevant code:

<% for ticket in @tickets %> <tr> <% for column in Ticket.content_columns %>    <% if column.human_name == "Status" %>      <% if ticket.send(column.name).eql?("true") %>        <td>Open</td>      <% else %>        <td>Closed</td>      <% end %>    <% else %>      <td><%=h ticket.send(column.name) %></td>    <% end %> <% end %>

My problem is as follows:

if ticket.send(column.name).eql?("true") always evaluates to false and prints Closed.

I haven't tested this, but I'm gonna guess that Ticket.status is a boolean field, but you're comparing it to the *string* "true". What happens if you do:

ticket.send(column.name).eql?(true)

?

Nevermind my bad. Passing true to eql? in the proper way fixed my problem.

However anyone know why == "true" wouldn't work when the same form works for checking the column name against "Status"?

true == "true"

=> false

true.class

=> TrueClass

"true".class

=> String

Thanks!

That would work too, and be a lot cleaner.

Thanks!