steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-11 17:28 UTC
more respond_to strangeness
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"} [4;35;1mQuestion Columns (0.004284) SHOW FIELDS FROM questions [4;36;1mQuestion Load (0.001594) [0;1mSELECT * FROM questions WHERE (questions.id = 7) Rendering actionshow.rxmllayoutfalse within layouts/simple Rendering questions/show.rxml ------------------------------- Am I missing something? BTW, this was working propertly last week. I had the error referenced in the link above but solved it once I stripped out the globalization stuff. I am running the latest edge rails. I just synched to the latest to see if that would help, but no joy. Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-12 20:26 UTC
Re: more respond_to strangeness
Okay, it is not just me. Here is a link to someone else having the same issue: http://www.mail-archive.com/sdruby-aMjmuwdsvJ9zcOJBaT+g/Q@public.gmane.org/msg00057.html I used Kevin''s suggestion which worked. respond_to do |wants| wants.xml { render :template => ''my_template.rxml'', :layout => false } end But I thought rails would automatically look for an method.rxml file and ignore any method.rhtml file. It seems you have to specify the rxml file however. It''s strange because I thought it was working last week without telling it to specifically render an rxml file. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sep 12, 2006, at 3:26 PM, steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Okay, it is not just me. Here is a link to someone else having the > same > issue: > http://www.mail-archive.com/sdruby-aMjmuwdsvJ9zcOJBaT+g/Q@public.gmane.org/msg00057.html > > I used Kevin''s suggestion which worked. > respond_to do |wants| > wants.xml { render :template => ''my_template.rxml'', :layout => false > } > end > > But I thought rails would automatically look for an method.rxml file > and ignore any method.rhtml file. It seems you have to specify the > rxml > file however. > > It''s strange because I thought it was working last week without > telling > it to specifically render an rxml file.If it previously found a .rhtml file during the same execution of your application in development mode, it will have cached it, and will continue to serve it even after you''ve created a new .rxml file. This can lead to some apparently random behavior. Don''t know if this could account for what you''re seeing. Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---