RESTful: redirect_to does not use GET?!

Hi all

I have the following update action:

  # PUT /music_artists/1
  # PUT /music_artists/1.xml
  def update
    music_artist = MusicArtist.find(params[:id])

    authorize_to!('EDIT', music_artist) do
      @page_title = "Edit #{music_artist.name}"
      respond_to do |format|
        if music_artist.update_attributes(params[:music_artist])
          flash[:notice] = 'Party organisator was successfully updated.'
          format.html { redirect_to music_artist_url(@program) }
          format.xml { head :ok }
        else
          @music_artist = music_artist
          format.html { render :action => "edit" }
          format.xml { render :xml => @music_artist.errors.to_xml }
        end
      end
    end
  end

Strangely, after update I get redirected to the correct URL
music_artists/123, but I'm getting the error "Unknown action"! It seems
that the redirect is done using POST! But the show action needs GET!

So what's going on here? Thanks for infos,
Josh

Hi all

I have the following update action:

  # PUT /music_artists/1
  # PUT /music_artists/1.xml
  def update
    music_artist = MusicArtist.find(params[:id])

    authorize_to!('EDIT', music_artist) do
      @page_title = "Edit #{music_artist.name}"
      respond_to do |format|
        if music_artist.update_attributes(params[:music_artist])
          flash[:notice] = 'Party organisator was successfully updated.'
          format.html { redirect_to music_artist_url(@program) }

What's @program. Shouldn't this be music_artist_url(music_artist) ?

Argh, I forgot to edit the form_for method call in _form.rhtml :wink:

Thanks anyway!