Rails comparison not working -
in rails, have workorders table. each workorder can have children workorders. i'm trying create dropdown links sibling workorders. i'm testing looking @ workorder.id = 30. has sibling workorder.id = 20. don't want display link same workorder user looking @ (30).
so put in test <% if child.id != @workorder %>
. but, 30 link still displays. added logger code see what's going on.
this code:
<li class="dropdown-header">siblings links</li> <% workorder.find(@workorder).parent.children.each |child| %> <%= logger.info 'look here ' %> <%= logger.info child.id %> <%= logger.info @workorder %> <% if child.id != @workorder %> <li><%= link_to child.id_desc, tasks_index4_path(:workorder_id => child) %></li> <% end %> <% end %>
the log shows:
look here 30 30 here 30 20
yet link_to 30 shows up.
thanks help!
use @workorder.to_i
in comparison
Comments
Post a Comment