I have a standard contacts_controller.rb with index action that responds as follows:
respond_to do |format|
format.html
format.xml { render :xml => @contacts }
end
In development, it works as intended: when I browse to http://localhost:3000/contacts , I get an html response.
But, when I start the app using capistrano on a remote Ubuntu server and browse to the same url, I get an xml response.
If I go to http://remote_host:8000/contacts.html , then I see the html response. If I comment out the format.xml { render :xml => @contacts }
, then I see the desired html response.
Pretty sure I'm missing something subtle about difference between Rails development and production modes. Any ideas about what I'm overlooking?
Thanks, - Dave
The following links explain the phenomenon:
http://geminstallthat.wordpress.com/2008/05/14/ie6-accept-header-is-faulty/
I fixed my issue by adding this to development|test|production.rb:
config.action_controller.use_accept_header = false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.