Toby Clemson
2007-Aug-08 16:07 UTC
Return an unauthorised header unless the request format is xml?
Hi, I''d like to return a header that indicates an action is unauthorised unless the request was an xml request. I''m using REST in my controllers and I only want create, delete and update capability for those requests that come from activerecord. How do I just return the relevant headers without performing the action when create, delete or update requests come in from html? so far I have: head :unauthorized(?) unless request.format.xml? I don''t think :unauthorized exists as one of the status'' I just put it in to show what I am trying to do. I tried a before filter that renders that header but that causes two a double render error. Any suggestions? Toby --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Toby Clemson
2007-Aug-08 16:35 UTC
Re: Return an unauthorised header unless the request format is xml?
Sorry when I said activerecord above I meant activeresource. On Aug 8, 5:07 pm, Toby Clemson <tobyclem...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''d like to return a header that indicates an action is unauthorised > unless the request was an xml request. I''m using REST in my > controllers and I only want create, delete and update capability for > those requests that come from activerecord. > > How do I just return the relevant headers without performing the > action when create, delete or update requests come in from html? > > so far I have: > > head :unauthorized(?) unless request.format.xml? > > I don''t think :unauthorized exists as one of the status'' I just put it > in to show what I am trying to do. > > I tried a before filter that renders that header but that causes two a > double render error. > > Any suggestions? > > Toby--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---