I''m having a problem in Rails 2 where respond_to is always rendering the RXML view even in the HTML rendering response. Can anyone tell me why this might be happening? Here''s a code snippet: respond_to do |accepts| accepts.html accepts.xml { render :action => ''show.rxml'', :layout => false} end If I change this to the following it works fine: respond_to do |accepts| accepts.html { render :action => ''show.rhtml'', :layout => true } accepts.xml { render :action => ''show.rxml'', :layout => false } end Here''s my setup: rails (2.0.2) mongrel (1.1.4) mongrel_cluster (1.0.5) apache (2.2.6) Thanks in advance! - Jason -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Craig Demyanovich
2008-Apr-20 21:35 UTC
Re: Why is respond_to always rending the RXML view?
On Sun, Apr 20, 2008 at 2:38 PM, Jason Fox <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > respond_to do |accepts| > accepts.html > accepts.xml { render :action => ''show.rxml'', :layout => false} > end > > If I change this to the following it works fine: > > respond_to do |accepts| > accepts.html { render :action => ''show.rhtml'', :layout => true } > accepts.xml { render :action => ''show.rxml'', :layout => false } > endThe only idea I have is that maybe you don''t need to use render :action. Instead, maybe you should be getting some XML from somewhere (such as calling #to_xml on a model or collection) and rendering it like this? respond_to do |accepts| accepts.html accepts.xml { render :xml => some_model.to_xml } end See also: http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M000211&name=respond_to Regards, Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---