Hi, I want to have a controller action that simply sets a few headers and respond without a body. [see below]. But Rails wants to load the erb template file for the action, which does not exist. Is there a way to instruct the controller to respond without loading the template ? Thanks ---- class PortController < ApplicationController def hello method = request.request_method case method when :options : headers[''Status''] = "200 OK" headers[''Access-Control-Allow-Methods''] = "POST,GET" when :get : ... when :post : ... else ... end end end ---- -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
render :nothing => true On Dec 15, 9:10 pm, tm65 <tm65atcolum...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I want to have a controller action that simply sets a few headers and > respond without a body. [see below]. But Rails wants to load the erb > template file for the action, which does not exist. Is there a way to > instruct the controller to respond without loading the template ? > > Thanks > > ---- > class PortController < ApplicationController > > def hello > method = request.request_method > case method > when :options : > headers[''Status''] = "200 OK" > headers[''Access-Control-Allow-Methods''] = "POST,GET" > when :get : > ... > when :post : > ... > else > ... > end > end > end > > ------ 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Thanks! On Dec 15, 7:45 pm, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> render :nothing => true > > On Dec 15, 9:10 pm, tm65 <tm65atcolum...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > > I want to have a controller action that simply sets a few headers and > > respond without a body. [see below]. But Rails wants to load the erb > > template file for the action, which does not exist. Is there a way to > > instruct the controller to respond without loading the template ? > > > Thanks > > > ---- > > class PortController < ApplicationController > > > def hello > > method = request.request_method > > case method > > when :options : > > headers[''Status''] = "200 OK" > > headers[''Access-Control-Allow-Methods''] = "POST,GET" > > when :get : > > ... > > when :post : > > ... > > else > > ... > > end > > end > > end > > > ------ 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.