ERROR NoMethodError: private method `gsub!' called

I have just upgraded to Ruby 1.8.7 and Rails 2.2.2. My previous project
was at Ruby 1.8.6 and Rails 2.0.2. My platform is Windows and Webrick
for development.

When I run Webrick, the server starts without error, the application
runs, database connections work and I can click through the pages and
display data. But it does not serve any stylesheets or javascript
files. What’s interesting is that images are displayed. In the log
file, I get a 500 error after it attempts to retrieve a stylesheet or
javascript. This occurs everytime.

Example of attempt to retrieve prototype.js (a 500 error):

127.0.0.1 - - [17/Mar/2010:23:52:52 Eastern Daylight Time] “GET
/javascripts/pro
totype.js?1268882775 HTTP/1.1” 500 338
Referer → /javascripts/prototype.js?1268882775
[2010-03-17 23:52:52] ERROR NoMethodError: private method `gsub!’ called
for #Class:0x44ee480

If I type directly into my browser’s address bar,
http://localhost:3001/javascripts/prototype.js?1268882775”, I get the
500 error message as above. If I leave off “?1268882775”, the browser
asks me to download the JS file.

I created a new rails app, started the webrick server, and it also
fails to run.

Any ideas what could be wrong? I’m stumped.

Thanks,

Chris

Sent from my iPhone

On Mar 17, 2010, at 9:29 PM, Chris M. [email protected] wrote:

javascript. This occurs everytime.

Thanks,

Chris

Chris, when you switched your app from 2.0.2 to 2.3.5, did you run
‘rake rails:update’ in the root of your project?

-Conrad

Chris, when you switched your app from 2.0.2 to 2.3.5, did you run
‘rake rails:update’ in the root of your project?

-Conrad

It was to 2.2.2 and, yes, I did run ‘rake rails:update’. Not sure if it
did anything. It didn’t give any output and returned to the command
prompt.

Since I was at an old rails version I tried to just upgrade to 2.1 with
not luck and then upgraded to 2.2.2 to see if that would help. Same
issue.

Thanks for the help.

Chris

On 18 March 2010 04:49, Chris M. [email protected] wrote:

Chris, when you switched your app from 2.0.2 to 2.3.5, did you run
‘rake rails:update’ in the root of your project?

-Conrad

It was to 2.2.2 and, yes, I did run ‘rake rails:update’. Not sure if it
did anything. It didn’t give any output and returned to the command
prompt.

You can tell whether it changed anything by checking your current
version against the version in your version control repository. If
you are not using one (git for example) start by setting one up. When
messing about upgrading rails and so on you need to be able to track
what you have done, revert experimental changes, and so on. A day or
two spent learning git will be recovered very quickly.

Colin

On 18 March 2010 04:29, Chris M. [email protected] wrote:

Example of attempt to retrieve prototype.js (a 500 error):

127.0.0.1 - - [17/Mar/2010:23:52:52 Eastern Daylight Time] “GET
/javascripts/pro
totype.js?1268882775 HTTP/1.1” 500 338
Referer → /javascripts/prototype.js?1268882775
[2010-03-17 23:52:52] ERROR NoMethodError: private method `gsub!’ called
for #Class:0x44ee480

Can you show us the rest of the error trace.

Colin

Colin L. wrote:

You can tell whether it changed anything by checking your current
version against the version in your version control repository. If
you are not using one (git for example) start by setting one up. When
messing about upgrading rails and so on you need to be able to track
what you have done, revert experimental changes, and so on. A day or
two spent learning git will be recovered very quickly.

Colin

I use subversion. Not much changed after executing “rake rails:update”
on my current project. I think it mainly changed the boot.rb file.

What is odd is that I even created a new rails app from scratch and it
is also having the same problem serving up anything from the public
folder—stylesheets, javascripts, images, etc… If I start webrick on
this new app, it appears that the “new rails app” page loads with the
images, but if I refresh, it immediately gives me the 500 errors on the
static content.

I think I’ve worked through most of the other problems related to all
the various plugins I’m using, but this issue still is puzzling why even
a new rails app has the same problem.

Chris

As much of the trace as I can get from my Windows command prompt. It
doesn’t log this to log/development.log. You’ll see GET calls and then
the 500 error followed by the “private method `gsub!’” error message
repeatedly. Seems to affect all of the static files—stylesheets,
javascripts, images. Sometimes it pulls images from my cache and if I
refresh the page the image is missing again…


    C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in 

require ' script/server:3 127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] "GET /javascripts/app lication.js?1263890390 HTTP/1.1" 500 338 Referer -> /javascripts/application.js?1263890390 127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] "GET /javascripts/jqu ery/jquery.js?1243816946 HTTP/1.1" 500 338 Referer -> /javascripts/jquery/jquery.js?1243816946 [2010-03-18 12:15:05] ERROR NoMethodError: private methodgsub!’ called
for #
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in escape' C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:inset_error’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick. rb:66 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:521:in new_constants_in' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

script/server:3
[2010-03-18 12:15:05] ERROR NoMethodError: private method gsub!' called for #<C lass:0x483e808> C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:inescape’
C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:in set_error' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.
rb:66
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:153:in require' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:521:innew_constants_in’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:153:in require' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' script/server:3 [2010-03-18 12:15:05] ERROR NoMethodError: private methodgsub!’ called
for #
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in escape' C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:inset_error’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick. rb:66 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:521:in new_constants_in' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

script/server:3
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/javascripts/cal
endar_date_select/format_american.js?1226806161 HTTP/1.1” 500 338
Referer ->
/javascripts/calendar_date_select/format_american.js?1226806161
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/javascripts/cal
endar_date_select/calendar_date_select.js?1232746900 HTTP/1.1” 500 338
Referer ->
/javascripts/calendar_date_select/calendar_date_select.js?1232746900
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/stylesheets/cal
endar_date_select/default.css?1255528591 HTTP/1.1” 500 338
Referer -> /stylesheets/calendar_date_select/default.css?1255528591
[2010-03-18 12:15:05] ERROR NoMethodError: private method gsub!' called for #<C lass:0x482c178> C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:inescape’
C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:in set_error' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.
rb:66
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:153:in require' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:521:innew_constants_in’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:153:in require' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' script/server:3 127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] "GET /javascripts/jqu ery/thickbox.js?1263700042 HTTP/1.1" 500 338 Referer -> /javascripts/jquery/thickbox.js?1263700042 [2010-03-18 12:15:05] ERROR NoMethodError: private methodgsub!’ called
for #
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in escape' C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:inset_error’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick. rb:66 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:521:in new_constants_in' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

script/server:3
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/javascripts/cal
endar_date_select/format_american.js?1226806161 HTTP/1.1” 500 338
Referer ->
/javascripts/calendar_date_select/format_american.js?1226806161
[2010-03-18 12:15:05] ERROR NoMethodError: private method gsub!' called for #<C lass:0x47d7cf8> C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:inescape’
C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:in set_error' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick.
rb:66
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:153:in require' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:521:innew_constants_in’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:153:in require' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' script/server:3 [2010-03-18 12:15:05] ERROR NoMethodError: private methodgsub!’ called
for #
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in escape' C:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:232:inset_error’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:94:in
handle_file' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:73:in
service’
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:60:in
dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/webrick. rb:66 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_ori
ginal_require’
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require ' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de
pendencies.rb:521:in new_constants_in' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/de pendencies.rb:153:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_ori ginal_require' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire

script/server:3
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/stylesheets/cal
endar_date_select/default.css?1255528591 HTTP/1.1” 500 338
Referer -> /stylesheets/calendar_date_select/default.css?1255528591
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/javascripts/jqu
ery/thickbox.js?1263700042 HTTP/1.1” 500 338
Referer -> /javascripts/jquery/thickbox.js?1263700042
127.0.0.1 - - [18/Mar/2010:12:15:05 Eastern Daylight Time] “GET
/images/btn_logi
n_sm.gif?1234253352 HTTP/1.1” 200 1543
Referer -> /images/btn_login_sm.gif?1234253352

On 18 March 2010 17:03, Chris M. [email protected] wrote:


What is odd is that I even created a new rails app from scratch and it
is also having the same problem serving up anything from the public
folder—stylesheets, javascripts, images, etc… If I start webrick on
this new app, it appears that the “new rails app” page loads with the
images, but if I refresh, it immediately gives me the 500 errors on the
static content.

Out of interest have you tried mongrel?
script/server mongrel

Otherwise I am out of my depth I am afraid.

Colin

On 18 March 2010 17:36, Chris M. [email protected] wrote:

Out of interest have you tried mongrel?
script/server mongrel

Otherwise I am out of my depth I am afraid.

Colin

Well, I executed “gem install mongrel”, then “ruby script/server
webrick” and everything is loading!!

I presume you mean “ruby script/server mongrel”

Colin

Well, I executed “gem install mongrel”, then “ruby script/server
webrick” and everything is loading!!

I presume you mean “ruby script/server mongrel”

Colin

Yes… Sorry. Webrick still on the mind.

ruby script/server mongrel

Works!

Out of interest have you tried mongrel?
script/server mongrel

Otherwise I am out of my depth I am afraid.

Colin

Well, I executed “gem install mongrel”, then “ruby script/server
webrick” and everything is loading!! What a bad problem with webrick.
My staging server is mongrel, but my production is phusion passenger
(which is a breeze to setup). I hope Passenger will be kind when I make
the next release to production!

I think it even cleared up an annoying “stack level too deep” error I
was getting with webrick and not caching classes in development.
Mongrel isn’t complaining.

Thanks for your help!

Chris

Chris M. wrote:

Well, I executed “gem install mongrel”, then “ruby script/server
webrick” and everything is loading!!

I presume you mean “ruby script/server mongrel”

Colin

Yes… Sorry. Webrick still on the mind.

ruby script/server mongrel

Works!

To continue using Webrick, instead of switching to Mongrel, you can also
just edit line 15 of lib/ruby/1.8/webrick/htmlutils.rb to read

  str = string ? string.to_s.dup : ""

The problem is that NotModified exception is getting passed to
HTMLUtils::escape as a class, rather than a string (originally raised in
HTTPServlet::DefaultFileHandler). Since the only things that can really
be HTML escaped are strings, it should be safe to always convert the
input to string.

I suspect that the potential performance penalty may prevent a solution
like that from making it to the standard ruby library, but it’s a simple
workaround.

Alternatively, in the handle_file method of webrick’s DispatchServlet
(lib/webrick_server.rb in the rails gem), before it calls res.set_error
with the exception, you could force the err.message to be a string, or
even clear the message, since I think it’s discarded anyway for
NotModified.

Michael

Thank you very much! How very obvious to change that line. A pitty I
haven’t tried to change it that way.

But now everything works just fine. I had the nearly same problem with
the same versions of Ruby and Rails but on Ubuntu. In my case
stylesheets etc. were loaded after some reloading of the page.

Thank you again!

thx it works for me :slight_smile: