title: Rails not redirecting on PUT request, sending 406 back instead
body: <p>I'm working on a bell schedule creator for a school project I'm working on. The bell schedule creation on the client is handled with a React component, and when it comes time to update, the component calls this fetch request:</p>
  <pre><code>fetch(`/bell-schedules/${this.state.updatingId}`, {
                  method: 'PUT',
                  mode: 'cors',
                  credentials: 'same-origin',
                  headers: {
                      'Content-Type': 'application/json',
                      'Accept': 'text/html',
                  },
                  redirect: &quot;follow&quot;,
                  referrerPolicy: 'no-referrer',
                  body: JSON.stringify({ name: this.state.name, schedule: json})})
  </code></pre>
  <p>On the server, these requests are handled by the BellSchedulesController, and the method for handling this type of route is coded as so:</p>
  <pre><code># PUT /bell-schedules/:id
    def update
      set_bell_schedule
      respond_to do |format|
        if @schedule.update(name: params[:name], schedule: params[:schedule])
          redirect_to action: 'index'
        else
          head 400
        end
      end
    end
  </code></pre>
  <p>Index is a simple method that gets all the bell schedules and renders them in a table; that method works fine, other routes point to it and it renders normally. Unfortunately, when I send this PUT request, rather than getting a redirect to that page showing the table of bell schedules, I instead get back a <strong>406 Not Acceptable</strong>. I also know that the bell schedule is actually updating, I've inspected the entry in the rails console.</p>
  <p>How do I handle redirects in PUT requests? I'm also having an issue similar to this in a POST request, but I've found a hack around it there; that hack won't work in this one.</p>