Home>

I will ask you a question for the first time.
I got the following error.
This was the first error I saw, and I couldn't figure it out, so please tell me the details of the error and the solution.

It will be displayed when you press the submit button in the modal below.
The target controller is also attached.


  
    
    <button type = "button" data-dismiss = "modal" aria-label = "Close">
      <span aria-hidden = "true">&times;</span>
    </button>
    
    
    <% = form_with (model: @user, url: "#", method:: patch, local: true) do | f |%>
      <% @ attendances.each do | id, attendance |%>
        <% user = User.find (id)%>
         <% = "[Application from # {user.name}]"%>
        <table>
          <thead>
            <th>date</th>
            <th>day of the week</th>
            <th>Scheduled to end</th>
            <th>Designated work</th>
            <th>Overtime</th>
            <th>Contents</th>
            <th>Confirm
                
                   mark 
                
            </th>
            <th>Change</th>
            <th>Confirm</th>
          </header>
          <% attendance.each do | day |%>
            <% = f.fields_for "attendance []", day do | d |%>
              <tbody>
                <td><% = l (day.worked_on, format:: short)%></td>
                <td><% = $days_of_the_week [day.worked_on.wday]%></td>
                <td><% = day.overtime_finished_at.try (: strftime, "% H:% M")%></td>
                <td><% = format_basic_info (user.designation_work_end_time)%></td>
                <td><% = overtime_worked_on (day.overtime_finished_at, user.designation_work_end_time, day.tomorrow)%></td>
                <td><% = day.overtime_work%></td>
                <td><% = d.select: invoker_reply, {'None': 1,'Applying': 2,'Approval': 3,'No': 4}, {prompt: false}, {class:'form -control input-sm'}%></td>
                <td><% = d.check_box: change, id: "change"%></td>
                <td><% = link_to "confirm", verifacation_user_path (user.id, worked_on: day.worked_on), class: "btn btn-primary"%></td>
              </tbody>
            <% end%>
          <% end%>
        </table>
          
          <% = f.submit "Change", class: "btn btn-primary"%>** ← This button **
          
      <% end%>
    <% end%>
    
  
def edit_overtime_notice
    @user = User.find (params [: user_id])
    @attendances = Attendance.where (indicater_check_superior: "Applying", indicater_check: @ user.name) .order (: user_id,: worked_on) .group_by (&: user_id)
  end

  def update_overtime_notice
  end
  • Answer # 1

    When I checked it again, was it resolved? (The error has been resolved).

    Factor →
    It seems that these errors can occur because Rails defines the protect_from_forgery method in aplication.controller.rb by default.

    Solution →
    Added protect_from_forgery on the development side

    class UsersController