I am trying to destroy a session created by Restful authentication plugin, but everything I''ve tried doesn''t work. I''ve been googling for a while but haven''t found anything that will fix this. These are the relevant lines that I currently have: config/routes.rb: map.resource :session, :member => {:logoff => :delete } app/views/layouts/credentials.html.erb: <%= link_to "logout", logoff_session_url %> Session Routes from ''rake routes'': POST /session {:controller=>"sessions", :action=>"create"} POST /session.:format {:controller=>"sessions", :action=>"create"} new_session GET /session/new {:controller=>"sessions", :action=>"new"} formatted_new_session GET /session/new.:format {:controller=>"sessions", :action=>"new"} edit_session GET /session/edit {:controller=>"sessions", :action=>"edit"} formatted_edit_session GET /session/edit.:format {:controller=>"sessions", :action=>"edit"} logoff_session DELETE /session/logoff {:controller=>"sessions", :action=>"logoff"} formatted_logoff_session DELETE /session/logoff.:format {:controller=>"sessions", :action=>"logoff"} session GET /session {:controller=>"sessions", :action=>"show"} formatted_session GET /session.:format {:controller=>"sessions", :action=>"show"} PUT /session {:controller=>"sessions", :action=>"update"} PUT /session.:format {:controller=>"sessions", :action=>"update"} DELETE /session {:controller=>"sessions", :action=>"destroy"} DELETE /session.:format {:controller=>"sessions", :action=>"destroy"} And the layout generates the following html: <a href="http://localhost:3000/session/logoff">logout</a> When I click on the logoff link, here is the error that shows up on the resulting page: ActionController::MethodNotAllowed Only delete requests are allowed. I know that the url has to somehow signify that the delete method is to be used since web browsers don''t support the delete method, but I''m not sure what I''m doing wrong. Can anybody help? Thanks, Jonathan --~--~---------~--~----~------------~-------~--~----~ 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 Oct 6, 5:25 am, JHuizingh <JHuizi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And the layout generates the following html: > > <a href="http://localhost:3000/session/logoff">logout</a> > > When I click on the logoff link, here is the error that shows up on > the resulting page: > > ActionController::MethodNotAllowed > Only delete requests are allowed.Well you''ve sort of figured it out yourself - Your routing demands a DELETE method, but your link is a plain old GET. Either you change your routing to accept GET requests or you use the :method option to link_to to fake up a DELETE request (watch out, this relies on javascript) Fred> > I know that the url has to somehow signify that the delete method is > to be used since web browsers don''t support the delete method, but I''m > not sure what I''m doing wrong. Can anybody help? > > Thanks, > Jonathan--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you. That was it. I could have sworn that I tried that, but I guess something else must have been wrong when I tried it. It works now. Thanks. Jonathan On Oct 6, 1:45 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Oct 6, 5:25 am, JHuizingh <JHuizi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > And the layout generates the following html: > > > <a href="http://localhost:3000/session/logoff">logout</a> > > > When I click on the logofflink, here is the error that shows up on > > the resulting page: > > > ActionController::MethodNotAllowed > > Only delete requests are allowed. > > Well you''ve sort of figured it out yourself - Your routing demands a > DELETE method, but yourlinkis a plain old GET. > Either you change your routing to accept GET requests or you use > the :method option to link_to to fake up a DELETE request (watch out, > this relies on javascript) > > Fred > > > > > I know that the url has to somehow signify that the delete method is > > to be used since web browsers don''t support the delete method, but I''m > > not sure what I''m doing wrong. Can anybody help? > > > Thanks, > > Jonathan--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---