The entry is not updated, it should change between true and false
class AsistenciaController < ApplicationController
def asistencia
@asistencia = User.all
end
def update
@username = User.find(params[:username])
@entry = User.find(params[:entry])
if @asistencia.update(asistencia_params)
redirect_to asistencia_path, notice: "Asistencia guardada correctamente"
else
render :edit, status: :unprocessable_entity
end
end
end
Started POST "/guardar_asistencia" for 127.0.0.1 at 2023-06-22 10:56:34 -0500
Processing by AsistenciaController#update as TURBO_STREAM
Parameters: {"authenticity_token"=>"[FILTERED]", "user_username"=>"", "username"=>"1", "entry"=>"false", "commit"=>"Registrar"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
↳ app/controllers/asistencia_controller.rb:7:in `update'
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", nil], ["LIMIT", 1]]
↳ app/controllers/asistencia_controller.rb:8:in `update'
Completed 404 Not Found in 19ms (ActiveRecord: 0.4ms | Allocations: 4468)
ActiveRecord::RecordNotFound (Couldn't find User with 'id'=false):
I tried with strong parameters and with patch but it doesn't work
I was hoping that by inserting the username I could change the entry between true and false
Aucun commentaire:
Enregistrer un commentaire