render xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

render xml

fugee ohu
I'm trying to respond xml for any action in my controller but not just by rendering an object I wanna use a view and all the examples I find show how to respond xml with an object like  `respond_with(@asd) # respond_with A` or `  format.xml { render xml: @asd}` 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/11d872be-6516-4492-a3ab-0e8370d0b950%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: render xml

fugee ohu


On Monday, October 8, 2018 at 1:43:32 PM UTC-4, fugee ohu wrote:
I'm trying to respond xml for any action in my controller but not just by rendering an object I wanna use a view and all the examples I find show how to respond xml with an object like  `respond_with(@asd) # respond_with A` or `  format.xml { render xml: @asd}` 


 class SitemapController < ApplicationController
  layout :false
  respond_to :xml


  def index
      @host = "#{request.protocol}#{request.host}"
      @people = Person.order("name")
      @pictures = Picture.all
      render
  end

end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0fecbb06-cab4-4258-bb7d-ee377f47bc74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: render xml

fugee ohu
In reply to this post by fugee ohu


On Monday, October 8, 2018 at 1:43:32 PM UTC-4, fugee ohu wrote:
I'm trying to respond xml for any action in my controller but not just by rendering an object I wanna use a view and all the examples I find show how to respond xml with an object like  `respond_with(@asd) # respond_with A` or `  format.xml { render xml: @asd}` 


Since google says my sitemap.xml is unknown type it must be I'm rendering xml but not seending an xml content/type header first So how do I send the header?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b7fa5132-2de3-4ff0-878a-cae157593400%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.