Forum: Rails-ES Re: relación circular de una entidad

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Angel Mauricio Pino Gonzalez (Guest)
on 2007-03-04 02:49
(Received via mailing list)
Gracias ahora si funciona en la vista lo siguiente:

<% for persona1 in @personas %>
  <tr>
    <td><%=h persona1.Nombres %></td>
    <td><%=h persona1.ap_paterno %></td>
    <td><%=h persona1.ap_materno %></td>
    <td><%=h persona1.RUT %> - <%=h persona1.Dig_verificador %></td>
    <td><%=h persona1.persona.nombrecompleto %>
    <td><%= link_to 'Editar', :action => 'edit', :id => persona1 %></td>
    <td><%= link_to 'Eliminar', { :action => 'destroy', :id => persona1
},
:confirm => 'Are you sure?', :post => true %></td>
  </tr>
<% end %>

Date: Sat, 3 Mar 2007 00:13:25 -0300
From: "Hernan F." <removed_email_address@domain.invalid>
Subject: Re: [Ror-es] relaci?n circular de una entidad
To: "La lista sobre Ruby On Rails (rubyonrails.com) en castellano"
       <removed_email_address@domain.invalid>
Message-ID:
       <removed_email_address@domain.invalid>
Content-Type: text/plain; charset="iso-8859-1"

Hola
por el c?digo que tienes en la vista me parece que la relaci?n deber?a
ser
has_one, no has_many
te recomiendo escribirlo de esta manera para que sea mas f?cil leerlo

class Persona < ActiveRecord::Base
   has_one :amigo,      :class_name => "Persona"
   belongs_to :amigo,   :class_name => "Persona"

 def nombre_completo
   ...
 end
end


saludos
Hern?n Fernandez
netflux.com.ar
This topic is locked and can not be replied to.