I have a simple client table (or model) where the Client can have a parent client (only one or none). I modeled it like this:
class Client < ActiveRecord::Base belongs_to :parent, :class_name => 'Client', :foreign_key => 'parent_id’ end
It seems to work. I have two questions:
I found a solution for # 2:
<div class="field"> <%=f.label :parent %><br/> <%= collection_select(:client, :parent_id, Client.all, :id, :name, {:include_blank => true} ) %> </div>
, # 1 . , , !
Source: https://habr.com/ru/post/1779014/More articles:Copy class instance - flexbackButton of NavigationController not showing up - objective-cВ Perl, как я могу получить доступ к скаляру, определенному в другом пакете? - perlcomponent clone - flexHaskell Error for "foldl1 (\ ab → (snd a + snd b)) [(1,2), (3,4)] - haskellTab in a text area without changing focus, jQuery - javascriptBehavior - dateUsing Vertex buffer objects for tile-based game and texture atlases - openglВывод URL-адреса HttpWebRequest - c#cannot execute (error 2) when using forfiles - batch-fileAll Articles