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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 2/27/08, Joshua Muheim <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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) ?> 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 > -- > Posted via http://www.ruby-forum.com/. > > > >-- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Argh, I forgot to edit the form_for method call in _form.rhtml ;-) Thanks anyway! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---