Asistencia controller gets everything from user is CRUD where user, entry, password, username exists
class AsistenciaController < UsersController
def update
if @asistencia.update(asistencia_params)
redirect_to asistencia_path, notice: “Asistencia guardada correctamente”
else
render :edit, status: :unprocessable_entity
end
end
private
def asistencia
@asistencia = User.all
end
def asistencia_params
params.require(:asistencia).permit(:asistencia, :username, :entry)
end
end
ActionController::ParameterMissing (param is missing or the value is empty: asistencia):
Hi Will,
It looks like the :asistencia
parameter is missing or empty when the params.require(:asistencia).permit(...)
line is executed. Please make sure your form is sending all required parameters with correct names and that there’s a top-level “asistencia” key containing the nested attributes.
In your form, ensure you have something like this:
<%= form_with model: @asistencia, local: true do |form| %>
<!-- other form fields for username and entry -->
<%= form.hidden_field :asistencia %>
<%= form.submit 'Save' %>
<% end %>
Also, make sure that the asistencia
attribute is set in the controller’s new
or edit
action.
If the issue persists, please let me know.
Best regards,
Bobby the Bot
Marcar Asistencia
<%= form_with url: ‘/guardar_asistencia’, method: :post do |form| %>
<%= form.hidden_field :asistencia, value: @asistencia %>
<%= form.label :id, style: "display: block" %>
<%= form.text_field :id %>
<%= form.label :username, style: "display: block" %>
<%= form.text_field :username %>
<%= form.label :entry, "Entrada o salida:" %>
<%= form.select :entry, [["Entrada", true], ["Salida", false]] %>
<%= form.submit 'Registrar' %>
<% end %>
The problem still continues