login_user
, as system_user
, this relation is polymorphic, since other types of users also have login_user
.
When creating the Admin form, I should add the fields of login_user
.
<%= form_for(@admin) do |f| %>
<%= f.fields_for :login_user do |login_user_fields|%>
<%= render partial: 'login_users/fields', locals:{f: login_user_fields, login_user: @admin.login_user, }%>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
The idea is that when creating a new admin , a login_user
is also created for it, any idea how to do it?