# Respond\_to block being ignored?

**URL:** <https://www.ruby-forum.com/t/respond-to-block-being-ignored/135080>\
**Category:** Rails\
**Created:** [April 17, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/respond-to-block-being-ignored/135080 "2008-04-17T17:28:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![el2king](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f08c70/32.png) [@el2king](https://www.ruby-forum.com/u/el2king)\
**Post date:** [April 17, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/respond-to-block-being-ignored/135080/1 "2008-04-17T17:28:55Z")

</div>

I am designing a Rails application with two separate controller scripts,  
say x\_controller\_1.rb and y\_controller\_2.rb, with both in  
app/controllers directory. Now, I have a function in each controller  
script that makes use of a respond\_to block. The block looks like this:

respond\_to do |format|  
format.html  
format.xml  
end

I have x.rhtml, x.rxml, y.rhtml, y.rmxl files in the app/views  
directory. When I submit an HTTP request to x\_controller with the  
header “Accept: text/xml”, the processed output from x.rxml is returned.  
However, when a request with the previous Accept header is submitted to  
y\_controller, the processed output from y.rhtml is returned. Now, there  
is no configuration between x\_controller and y\_controller, I have tried  
to remove any caching that the Rails application has done for previous  
accesses to these controllers, and I do not have the globalize plugin  
installed in this Rails application. Has anyone else seen this behavior  
before? If so, what is the solution to resolve this?

Thanks,  
Edward

---

<div class="post-metadata">

**Author:** ![el2king](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f08c70/32.png) [@el2king](https://www.ruby-forum.com/u/el2king)\
**Post date:** [April 17, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/respond-to-block-being-ignored/135080/2 "2008-04-17T17:30:19Z")

</div>

Sorry, in my previous post, I meant to say there is no configuration  
difference between the two controllers. Can anyone shed some light on  
this issue for me? Thanks!

Edward L. wrote:

> I am designing a Rails application with two separate controller scripts,  
> say x\_controller\_1.rb and y\_controller\_2.rb, with both in  
> app/controllers directory. Now, I have a function in each controller  
> script that makes use of a respond\_to block. The block looks like this:
> 
> respond\_to do |format|  
> format.html  
> format.xml  
> end
> 
> I have x.rhtml, x.rxml, y.rhtml, y.rmxl files in the app/views  
> directory. When I submit an HTTP request to x\_controller with the  
> header “Accept: text/xml”, the processed output from x.rxml is returned.  
> However, when a request with the previous Accept header is submitted to  
> y\_controller, the processed output from y.rhtml is returned. Now, there  
> is no configuration between x\_controller and y\_controller, I have tried  
> to remove any caching that the Rails application has done for previous  
> accesses to these controllers, and I do not have the globalize plugin  
> installed in this Rails application. Has anyone else seen this behavior  
> before? If so, what is the solution to resolve this?
> 
> Thanks,  
> Edward

---

<div class="post-metadata">

**Author:** ![el2king](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f08c70/32.png) [@el2king](https://www.ruby-forum.com/u/el2king)\
**Post date:** [April 17, 2008, 7:39pm UTC](https://www.ruby-forum.com/t/respond-to-block-being-ignored/135080/3 "2008-04-17T19:39:22Z")

</div>

Could someone please respond to the trouble I am having? I need a  
response ASAP. Thanks!
