2

I have problems installing any Ruby On Rails app on my shared hosted server. Mongrel shows html as plain text for all pages. The problem occurs for any app, even if I create a test empty app and add a scaffolded view without changing anything.

It appears that the Mongrel crashes when trying to put cookies to the response header. The HTTP header looks incomplete, the Content-type and other parameters are missing:

curl 127.0.0.1:12002/users -I
HTTP/1.1 200 OK
Connection: close
Date: Wed, 26 May 2010 09:46:50 GMT
Content-Length: 0

Here is the output from mongrel.log

Error calling Dispatcher.dispatch #<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]>
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send_cookies'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:136:in `out'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start'

ruby 1.8.7 rails 2.3.8 mongrel 1.1.5

Here is the link to the test page.

Has anyone seen anything like this?

Evgenii
  • 36,389
  • 27
  • 134
  • 170

3 Answers3

2

This workaround fixed mine: https://rails.lighthouseapp.com/projects/8994/tickets/4690#ticket-4690-23

It is basically adding this mongrel.rb under config/initializers

http://gist.github.com/471663

Yousef Salimpour
  • 694
  • 1
  • 7
  • 15
1

In my case, this exact problem occurred when running mongrel with the "mongrel_rails" command. Using "script/server" command (which also launches mongrel if it's present) solved the issue.

Maybe you could write to your webhosting provider to check on this.

foresth
  • 5,823
  • 4
  • 17
  • 8
0

I posted a solution here:

https://rails.lighthouseapp.com/projects/8994/tickets/4690

Let me know if it works for you.

Thanks, Mike C

Mike C
  • 31
  • 1
  • 2
  • Thank you for your answer. Unfortunately I'm not qualified to make fixes to source code of the framework. For now I've just rolled back to 2.3.5 and will be waiting for version 3. – Evgenii Jul 27 '10 at 03:47