# Undefined method \`^' for "d":String

**URL:** <https://www.ruby-forum.com/t/undefined-method-for-d-string/175398>\
**Category:** Rails\
**Created:** [September 12, 2009, 6:14pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398 "2009-09-12T18:14:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LFLFLF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@LFLFLF](https://www.ruby-forum.com/u/LFLFLF)\
**Post date:** [September 12, 2009, 6:14pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398/1 "2009-09-12T18:14:15Z")

</div>

Hi guys.

I’m a freshman on Rails (and Ruby) so I’m sorry if my question is  
pretty basic, and possible has a vary basic answer. I tried to Google  
this problem, but a couple of hour after and no solution found, I  
decided to ask for help here.

I have installed ruby 1.9.1p243, Rails 2.3.4, Gem 1.3.5, SQLite  
version 3.6.18 (I think this is all that it’s needed).  
I´m reading and implementing simultaneously Depot sample app presented  
in the book Agile Web D. with Rails. After creating the Model  
(just a simple table Products) and generating the controller and views  
through the generate script with scaffolding enabled, and applying the  
respective migration to the database (SQLite), when I access the  
default action on Products controller (index), I get the following  
error:

* * *

Showing app/views/layouts/products.html.erb where line #12 raised:

undefined method `^’ for “d”:String

Extracted source (around line #12):

9:   
10:   
11:  
12:

\<%= flash[:notice] %\>

  
13:  
14: \<%= yield %\>  
15:

RAILS\_ROOT: C:/lfalcao/Work/Dev/Ruby/Rails/Depot  
Application Trace | Framework Trace | Full Trace

## C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/ lib/active\_support/message\_verifier.rb:46:in `block in secure_compare' C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/ lib/active_support/message_verifier.rb:45:in`each’ C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/ lib/active\_support/message\_verifier.rb:45:in `secure_compare' C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/ lib/active_support/message_verifier.rb:28:in`verify’ C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action\_controller/session/cookie\_store.rb:156:in `unmarshal' C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action_controller/session/cookie_store.rb:145:in`load\_session’ C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action\_controller/session/abstract\_store.rb:62:in `block in load!' C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action_controller/session/abstract_store.rb:70:in`stale\_session\_check!’ C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action\_controller/session/abstract\_store.rb:61:in `load!' C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action_controller/session/abstract_store.rb:28:in`[]’ C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/ action\_controller/flash.rb:163:in `flash' C:1:in`flash’ C:/lfalcao/Work/Dev/Ruby/Rails/Depot/app/views/layouts/ products.html.erb:12:in `_run_erb_app47views47layouts47products46html46erb' C:/lfalcao/Work/Dev/Ruby/Rails/Depot/app/controllers/ products_controller.rb:7:in`index’

This is the default view generated. I haven’t touched it yet. What is  
this problem? Do I need to install something else? Am I doing anything  
wrong?  
I’m sorry if this is a basic one, but I tried everything (which is  
very little) I know. Anybody can help me?

Thanks!

---

<div class="post-metadata">

**Author:** ![LFLFLF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@LFLFLF](https://www.ruby-forum.com/u/LFLFLF)\
**Post date:** [September 12, 2009, 6:20pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398/2 "2009-09-12T18:20:06Z")

</div>

On Sep 12, 5:00 pm, LF [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This is the default view generated. I haven’t touched it yet. What is  
> this problem? Do I need to install something else? Am I doing anything  
> wrong?  
> I’m sorry if this is a basic one, but I tried everything (which is  
> very little) I know. Anybody can help me?

It’s a bug in rails:  
[https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234](https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234)

The change in question was a security fix - for the purpose of  
learning rails you could revert to rails 2.3.3 without ill effect  
(make sure you have that version of the gem installed and set  
RAILS\_GEM\_VERSION in environment.rb)

Fred

---

<div class="post-metadata">

**Author:** ![LFLFLF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@LFLFLF](https://www.ruby-forum.com/u/LFLFLF)\
**Post date:** [September 12, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398/3 "2009-09-12T21:39:05Z")

</div>

Thanks Fred. That solved my problem.  
I Installed version 2.3.3 and then I had to rebuild the application  
from scratch, because only changing the variable RAILS\_GEM\_VERSION in  
environment.rb, still gave me the error pasted bellow, of a missing  
method, I guess, when I started the WEBrick server.  
Then I rebuilt the application with for the version 2.3.3 and all  
works fine.

Thanks again

* * *

=\> Booting WEBrick  
=\> Rails 2.3.3 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
C:/lfalcao/Work/Dev/Ruby/Rails/Depot1/config/initializers/  
new\_rails\_defaults.rb:14:in `<top (require d)>': undefined method `generate\_best\_match=’ for  
ActionController::Routing:Module (NoMethodError)  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:145:in `load' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:145:in `block in load\_with\_new\_constant\_marking’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:521:in `new_constants_in' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:145:in `load\_with\_new\_constant\_marking’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/initializer.rb:622:in `block in load_application_initializers' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ rails-2.3.3/lib/initializer.rb:621:in`  
each’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/initializer.rb:621:in `load_application_initializers' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ rails-2.3.3/lib/initializer.rb:176:in`  
process’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/initializer.rb:113:in `run' from C:/lfalcao/Work/Dev/Ruby/Rails/Depot1/config/ environment.rb:9:in`\<top (required)\>’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:156:in `require' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:156:in `block in require’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:521:in `new_constants_in' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:156:in `require’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/commands/server.rb:84:i  
n `<top (required)>' from script/server:3:in `require’  
from script/server:3:in `’

* * *

On Sep 12, 5:18 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![LFLFLF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@LFLFLF](https://www.ruby-forum.com/u/LFLFLF)\
**Post date:** [October 5, 2009, 11:39pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398/4 "2009-10-05T23:39:44Z")

</div>

I confirm that just replacing RAILS\_GEM\_VERSION outputs the same  
error.

Is there a workaround for this ?

---

<div class="post-metadata">

**Author:** ![LFLFLF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@LFLFLF](https://www.ruby-forum.com/u/LFLFLF)\
**Post date:** [September 12, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398/5 "2009-09-12T21:39:40Z")

</div>

Thanks Fred. That solved my problem.  
I Installed version 2.3.3 and then I had to rebuild the application  
from scratch, because only changing the variable RAILS\_GEM\_VERSION in  
environment.rb, still gave me the error pasted bellow, of a missing  
method, I guess, when I started the WEBrick server.  
Then I rebuilt the application with for the version 2.3.3 and all  
works fine.

Thanks again

* * *

=\> Booting WEBrick  
=\> Rails 2.3.3 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
C:/lfalcao/Work/Dev/Ruby/Rails/Depot1/config/initializers/  
new\_rails\_defaults.rb:14:in `<top (require d)>': undefined method `generate\_best\_match=’ for  
ActionController::Routing:Module (NoMethodError)  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:145:in `load' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:145:in `block in load\_with\_new\_constant\_marking’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:521:in `new_constants_in' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:145:in `load\_with\_new\_constant\_marking’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/initializer.rb:622:in `block in load_application_initializers' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ rails-2.3.3/lib/initializer.rb:621:in`  
each’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/initializer.rb:621:in `load_application_initializers' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ rails-2.3.3/lib/initializer.rb:176:in`  
process’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/initializer.rb:113:in `run' from C:/lfalcao/Work/Dev/Ruby/Rails/Depot1/config/ environment.rb:9:in`\<top (required)\>’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:156:in `require' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:156:in `block in require’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
activesupport-2.3.3/lib/active\_support/  
dependencies.rb:521:in `new_constants_in' from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/ activesupport-2.3.3/lib/active_support/ dependencies.rb:156:in `require’  
from C:/Ruby/Ruby1.9.1-p243/lib/ruby/gems/1.9.1/gems/  
rails-2.3.3/lib/commands/server.rb:84:i  
n `<top (required)>' from script/server:3:in `require’  
from script/server:3:in `’

* * *

On Sep 12, 5:18 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![LFLFLF](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ba9def/32.png) [@LFLFLF](https://www.ruby-forum.com/u/LFLFLF)\
**Post date:** [October 5, 2009, 11:41pm UTC](https://www.ruby-forum.com/t/undefined-method-for-d-string/175398/6 "2009-10-05T23:41:30Z")

</div>

On Oct 5, 8:58 pm, benoror [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I confirm that just replacing RAILS\_GEM\_VERSION outputs the same  
> error.
> 
> Is there a workaround for this ?

you could remove the corresponding line from new\_rails\_defaults.rb -  
sounds like the version 2.3.4 generates by default contains an option  
that only exists from rails 2.3.4 onwards.

Fred
