# ERROR NoMethodError: private method \`gsub!' called

**URL:** <https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319>\
**Category:** Rails\
**Created:** [March 18, 2010, 5:29am UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319 "2010-03-18T05:29:35Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 5:29am UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/1 "2010-03-18T05:29:35Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 5:43am UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/2 "2010-03-18T05:43:57Z")

</div>

Sent from my iPhone

On Mar 17, 2010, at 9:29 PM, Chris M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 5:49am UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/3 "2010-03-18T05:49:14Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 12:49pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/4 "2010-03-18T12:49:28Z")

</div>

On 18 March 2010 04:49, Chris M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 12:45pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/5 "2010-03-18T12:45:58Z")

</div>

On 18 March 2010 04:29, Chris M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 6:03pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/6 "2010-03-18T18:03:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 5:48pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/7 "2010-03-18T17:48:44Z")

</div>

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 method`gsub!’ called  
for #  
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape' 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:in `service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in`run’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' 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:in  
`require ' 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:in `new_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:in  
`gem_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 method `gsub!' called for #<C lass:0x483e808> C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in`escape’  
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:in`service’  
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in`start\_thread’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start\_thread’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`each’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in`start’  
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:in`require  
’  
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:in`new\_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:in`gem\_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 method`gsub!’ called  
for #  
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape' 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:in `service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in`run’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' 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:in  
`require ' 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:in `new_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:in  
`gem_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/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:in`escape’  
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:in`service’  
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in`start\_thread’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start\_thread’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`each’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in`start’  
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:in`require  
’  
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:in`new\_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:in`gem\_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 method`gsub!’ called  
for #  
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape' 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:in `service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in`run’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' 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:in  
`require ' 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:in `new_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:in  
`gem_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/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:in`escape’  
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:in`service’  
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in`start\_thread’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start\_thread’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`each’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start' C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in`start’  
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:in`require  
’  
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:in`new\_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:in`gem\_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 method`gsub!’ called  
for #  
C:/ruby/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape' 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:in `service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in`run’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`start’  
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' 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:in  
`require ' 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:in `new_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:in  
`gem_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  
/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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 6:16pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/8 "2010-03-18T18:16:11Z")

</div>

On 18 March 2010 17:03, Chris M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 6:45pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/9 "2010-03-18T18:45:28Z")

</div>

On 18 March 2010 17:36, Chris M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 6:58pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/10 "2010-03-18T18:58:54Z")

</div>

> > 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!

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 18, 2010, 6:36pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/11 "2010-03-18T18:36:06Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [June 10, 2010, 3:19am UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/12 "2010-06-10T03:19:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [November 12, 2011, 8:25am UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/13 "2011-11-12T08:25:44Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![chrismalek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/6de8d8/32.png) [@chrismalek](https://www.ruby-forum.com/u/chrismalek)\
**Post date:** [March 19, 2012, 1:13pm UTC](https://www.ruby-forum.com/t/error-nomethoderror-private-method-gsub-called/185319/14 "2012-03-19T13:13:53Z")

</div>

thx it works for me 🙂
