title: Why am I getting an error on my rails for "Unpermitted parameters: :id, :reservation"?
body: <p>Currently im not able to update my obj becuz im getting a rails 422 unprocessible entity error .I have defined all the params properly not sure why this is happening pls take a look at my code below.I have a rails backend and react front end.
  Routes.rb In my console I get a &quot;EditReservationForm.js:14          PATCH http://localhost:4000/reservations/2 422 (Unprocessable Entity)&quot;  and in the rails logs</p>
  <pre><code>Started PATCH &quot;/reservations/2&quot; for 127.0.0.1 at 2022-09-01 11:53:07 +0530
  Processing by ReservationsController#update as */*
    Parameters: {&quot;name&quot;=&gt;&quot;koshieee&quot;, &quot;date&quot;=&gt;&quot;2022-08-30&quot;, &quot;time&quot;=&gt;&quot;2000-01-01T18:29:00.000Z&quot;, &quot;num&quot;=&gt;2, &quot;contact&quot;=&gt;12345, &quot;occasion&quot;=&gt;&quot;Bday&quot;, &quot;id&quot;=&gt;&quot;2&quot;, &quot;reservation&quot;=&gt;{&quot;name&quot;=&gt;&quot;koshieee&quot;, &quot;date&quot;=&gt;&quot;2022-08-30&quot;, &quot;time&quot;=&gt;&quot;2000-01-01T18:29:00.000Z&quot;, &quot;num&quot;=&gt;2, &quot;contact&quot;=&gt;12345, &quot;occasion&quot;=&gt;&quot;Bday&quot;}}
  hello
  4
  </code></pre>
  <pre><code>Rails.application.routes.draw do
    
    resources :reservations,only: [:index,:show,:create,:update,:destroy]
    resources :reviews,only: [:index,:create,:destroy]
    resources :restaurants,only: [:index]
   
  
    
    post &quot;/signup&quot;, to: &quot;users#create&quot;
    get &quot;/me&quot;, to: &quot;users#show&quot;
    post &quot;/login&quot;, to: &quot;sessions#create&quot;
    delete &quot;/logout&quot;, to: &quot;sessions#destroy&quot;
   
  end
  
  </code></pre>
  <p>Reservation controller</p>
  <pre><code>class ReservationsController &lt; ApplicationController
      def index
          reservations = @current_user.reservations
           render json: reservations
        end
  
        def show
          reservation = Reservation.find_by(id: params[:id])
          if reservation
            render json: reservation
          else
            render json: { error: &quot;Reservation not found&quot; }, status: :not_found
          end
  
        end
  
      def create
          reservation=Reservation.create!(reservation_params)
          render json: reservation,status: :created
  
  
      end
  
      def update
          reservation = Reservation.find_by(id: params[:id])
          reservation.update!(reservation_params)
          render json: reservation,status: :ok
  
      end
    
  
      def destroy
     
          reservation = Reservation.find_by(id:params[:id])
          if reservation
            reservation.destroy
            head :no_content
  
          else
              render json: {error: &quot;Reservation Not Found .&quot;}, status: :not_found
          end
      end
  
  
  
      private
      
      def reservation_params
          params.permit(:name, :date, :time, :num, :contact, :occasion,:user_id,:restaurant_id)
  
      end
     
  end
  </code></pre>
  <pre><code>EditForm.js
  
  import { useState } from &quot;react&quot;;
  function EditReservationForm({reservation,onUpdateReservation}){
      const{ name, date, time, num, contact, occasion}=reservation;
      const[updateName,setUpdatedName]=useState(name);
     const[updateDate,setUpdatedDate]=useState(date);
     const[updateTime,setUpdatedTime]=useState(time);
     const[updateNum,setUpdatedNum]=useState(num);
     const[updateContact,setUpdatedContact]=useState(contact);
     const[updateOccasion,setUpdatedOccasion]=useState(occasion);
  
     function handleEditClick(e) {
         e.preventDefault()
    
              fetch(`/reservations/${reservation.id}`, {
                method: &quot;PATCH&quot;,
              headers: {
                  &quot;Content-Type&quot;: &quot;application/json&quot;,
                },
              body: JSON.stringify({ name:updateName,date:updateDate, time:updateTime,num:updateNum,contact:updateContact,occasion:updateOccasion}),
               })
                 .then((r) =&gt; r.json())
                .then((updatedReservation) =&gt; {
                   onUpdateReservation(updatedReservation);
                });
         }
      return(
          &lt;&gt;
         &lt;h2&gt;Modify Reservation&lt;/h2&gt;
         &lt;form onSubmit={handleEditClick}  &gt;
          &lt;div &gt;
          &lt;label htmlFor=&quot;name&quot;  &gt;Name&lt;/label&gt;
           &lt;input type=&quot;text&quot; name=&quot;name&quot;  value={updateName}    onChange={(e) =&gt; setUpdatedName(e.target.value)} placeholder=&quot;name&quot; /&gt;
         &lt;/div&gt;
         &lt;div &gt;
          &lt;label htmlFor=&quot;date&quot;  &gt;Date&lt;/label&gt;
           &lt;input type=&quot;date&quot; name=&quot;date&quot;   value={updateDate}  onChange={(e) =&gt; setUpdatedDate(e.target.value)}  placeholder=&quot;date&quot; /&gt;
         &lt;/div&gt;
         &lt;div &gt;
          &lt;label htmlFor=&quot;time&quot;  &gt;Time&lt;/label&gt;
           &lt;input type=&quot;time&quot; name=&quot;time&quot;  value={updateTime}  onChange={(e) =&gt; setUpdatedTime(e.target.value)} placeholder=&quot;time&quot; /&gt;
         &lt;/div&gt;
         &lt;div &gt;
          &lt;label htmlFor=&quot;num&quot;  &gt;Num&lt;/label&gt;
           &lt;input type=&quot;number&quot; name=&quot;num&quot;  value={updateNum}  onChange={(e) =&gt; setUpdatedNum(e.target.value)}  placeholder=&quot;num&quot; /&gt;
         &lt;/div&gt;
         &lt;div &gt;
          &lt;label htmlFor=&quot;date&quot;  &gt;Contact&lt;/label&gt;
           &lt;input type=&quot;tel&quot; name=&quot;contact&quot; value={updateContact}  onChange={(e) =&gt; setUpdatedContact(e.target.value)}  placeholder=&quot;contact&quot; /&gt;
         &lt;/div&gt;
         &lt;div &gt;
          &lt;label htmlFor=&quot;occasion&quot;  &gt;Occasion&lt;/label&gt;
           &lt;input type=&quot;text&quot; name=&quot;occasion&quot;  value={updateOccasion}   onChange={(e) =&gt; setUpdatedOccasion(e.target.value)} placeholder=&quot;occasion&quot; /&gt;
         &lt;/div&gt;
         &lt;button type=&quot;submit&quot;&gt;Update Reservation&lt;/button&gt;
         &lt;/form&gt;
          
          &lt;/&gt;
      )
  }
  export default EditReservationForm;
  ```
  
  </code></pre>