Forum: Ruby on Rails strange output in http header

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cb33b32bd5d675db7be148542976e510?d=identicon&s=25 Sam Joseph (Guest)
on 2005-12-29 16:39
(Received via mailing list)
Hi there,

I'm experiencing something strange in rails http headers. The response
comes back as text/plain. The http header looks like this:

HTTP/1.1 200 OK
Date: Thu, 29 Dec 2005 15:18:18 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ruby/1.2.4
Ruby/1.8.4(2005-10-29)
#<#<Class: 0x40a7f818>:0x40a7f778>Content-Type: text/html
Cache-Control: no-cache
Set-Cookie: _session_id=fdbd2acf8c42295dc24b163a9fe9db95; path=/
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain

It looks like some odd kind of class is preventing the Content-Type from
being set properly - look at the 4th line.

Does anybody have any idea what might cause this? I'm using rails 0.13
and this problem occurs on both windows and debian, and only really
causes a problem in firefox.

The code that generates this is as follows:

def tree
items_per_page = 5
if !params[:items_per_page].nil?
items_per_page = params[:items_per_page].to_i
end
@conditions = "parent_id IS NULL"
logger.info params[:id]
unless params[:id].nil?
logger.info "creating discussion"
@conditions += " AND creation_disc_id = "+params[:id]
@discussion = Discussion.find(params[:id])
end
@message_pages = Paginator.new self, Message.count( @conditions ),
items_per_page, @params['page']
@messages = Message.find(:all, :conditions => @conditions, :order =>
'creation_date DESC',
:limit => @message_pages.items_per_page, :offset =>
@message_pages.current.offset)
if params[:context] == 'small'
render :layout => false
end
end

and I've tried explicitly setting the content header (
@headers["Content-Type"] = "text/html" ) to no avail. there are various
before_filters running but nothing I can see that would cause something
like this.

The really weird thing is that it works fine sometimes, but not others -
haven't yet worked out any consistent pattern.

Any help greatly appreciated.

Many thanks.

CHEERS> SAM
This topic is locked and can not be replied to.