I'm looking for some debugging tips on this respond_to strangeness. My xml file is being rendered within my html layout.
this is a different problem than the question I posted here: http://groups.google.com/group/rubyonrails-talk/browse_frm/thread/cb835c10fdda3478/8aa485a9333c2e84?lnk=gst&q=respond_to+strangeness&rnum=1#8aa485a9333c2e84 In that problem, rails was not detecting that I had an .rhtml file, when I did. Turned out to be a conflict between respond_to and the globalize_rails plug-in I was using. I have since stripped out globalize functionality.
Here is my controller...
def show @question = Question.find(params[:id]) respond_to do |type| type.html type.js type.xml end end
For xml views, I have an show.rxml view for it to render.
The html view works fine, but if I request the page in xml format, the xml view gets rendered properly, but within my html layout!
If I do something like: type.xml {render :xml => @question.to_xml} that xml renders fine. But if I tell it render an .rxml file, it renders my html layout around it.
My development log shows this when I access the xml file: Processing QuestionsController#show (for 127.0.0.1 at 2006-09-11 12:06:48) [GET] Session ID: de93f56a6915c01446ca0f58e9acf14d Parameters: {"format"=>"xml", "action"=>"show", "id"=>"7", "controller"=>"questions"} e[4;35;1mQuestion Columns (0.004284)e[0m e[0mSHOW FIELDS FROM questionse[0m e[4;36;1mQuestion Load (0.001594)e[0m e[0;1mSELECT * FROM questions WHERE (questions.id = 7) e[0m Rendering actionshow.rxmllayoutfalse within layouts/simple Rendering questions/show.rxml