lundi 19 octobre 2020

Can't print data "name" ruby on rails

I am trying to print data from a object "root" to a table, everythink work fine but not printing this name i dont know why.

Code :

<% root = NameOfDatabase.find_by_student_id(student.id) %>
            <%  logger.info root.inspect %>
            <% if root.nil? %>
           <td class="col-4"> <% "-" %> </td>
           <%  else %>
           <td class="col-4"> <% root.name %> </td>
           <% end %>

Picture: View

Log file :

...  
#<Name**** id: ****, student_id: ****, name: "Alice", school_id: ****>
Completed in 99ms (View: 7, DB: 33) | 200 OK [https://*********/new_students/search_ajax?option=active&query=s001]

As following in root we have data i want only print root.name in table !!

thanks you

Aucun commentaire:

Enregistrer un commentaire