What do the resource and as:resource_name in ( ) of ruby's device mean?
I am struggling because I cannot understand the form_for itself.Someone please.
<%=form_for(resource, as:resource_name, url:registration_path(resource_name))do|f|%>
<div class='register_back'>
<div class='log-up'>
<%=render partial: 'common/login_logo'%>
<div class='log-in-inner'>
<h2>Membership </h2>
<%=form_for(resource, as:resource_name, url:registration_path(resource_name))do|f|%>
<%=device_error_messages!%>
<div class='form-group'>
<%=f.label: email address %><br/>
<%=f.email_field:email,autofocus:true,class:'form-control'%>
</div>
<div class='form-group'>
<%=f.label: Password %>
<%if@validatable%>
<em>(<%=@minimum_password_length%> characters or more)</em>
<%end%><br/>
<%=f.password_field:password,autocomplete:'off',class:'form-control'%>
</div>
<div class='form-group'>
<%=f.label: Password (confirmation) %><br/>
<%=f.password_field:password_confirmation,autocomplete:'off',class:'form-control'%>
</div>
<div class='form-group'>
<%=f.label: Group name (half-width alphanumeric) %><br/>
<%=f.text_field:group_key,class:'form-control'%>
</div>
<div class='actions'>
<%=f.submit class: 'btn btn-primary with ripple', value: 'New registration'%>
</div>
<%end%>
<%=render'device/shared/links'%>
</div>
</div>
</div>
For example, User
is using device
:user
will be
Although the device can handle any class name, it abstracts the template so that it can still be common.
© 2024 OneMinuteCode. All rights reserved.