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

**URL:** <https://www.ruby-forum.com/t/undefined-method-for-e-string/178016>\
**Category:** Rails\
**Created:** [October 28, 2009, 1:56am UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016 "2009-10-28T01:56:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 1:56am UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/1 "2009-10-28T01:56:41Z")

</div>

I’m attempting to learn Ruby on Rails, but these errors aren’t helping.  
I’m currently trying to follow the lessons available on  
[www.learningrails.com](http://www.learningrails.com). I received this error after trying to visit a  
page generated by using the scaffold command. Actually, this is all I  
did up until the error:

rails sample2 -d mysql  
mysqladmin -u root -p create sample2\_development  
ruby script/generate controller pages home resources about contact  
ruby script/generate scaffold page name:string title:string body:text  
rake db:migrate

Then after visiting localhost:3000/pages/new, this error occurred…

Showing app/views/pages/new.html.erb where line #3 raised:  
undefined method `^’ for “e”:String

Extracted source (around line #3):  
1:

# New page
  
2:  
3: \<% form\_for(@page) do |f| %\>  
4: \<%= f.error\_messages %\>  
5:  
6: 

/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active\_support/message\_verifier.rb:46:in  
`block in secure_compare' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/message_verifier.rb:45:in `each’  
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active\_support/message\_verifier.rb:45:in  
`secure_compare' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/message_verifier.rb:28:in `verify’  
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action\_controller/session/cookie\_store.rb:156:in  
`unmarshal' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:145:in `load\_session’  
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action\_controller/session/abstract\_store.rb:62:in  
`block in load!' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/session/abstract_store.rb:70:in `stale\_session\_check!’  
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action\_controller/session/abstract\_store.rb:61:in  
`load!' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/session/abstract_store.rb:28:in `[]’  
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action\_controller/request\_forgery\_protection.rb:102:in  
`form_authenticity_token' (eval):2:in `form\_authenticity\_token’  
/Users/username/Sites/Ruby/sample2/app/views/pages/new.html.erb:3:in  
`_run_erb_app47views47pages47new46html46erb' /Users/username/Sites/Ruby/sample2/app/controllers/pages_controller.rb:29:in `new’

I read another post on here that reported an error similar to this and  
it lead to this patch:  
[https://rails.lighthouseapp.com/projects/8994/tickets/3144/](https://rails.lighthouseapp.com/projects/8994/tickets/3144/)

However, this patch is apparently specifying message\_verifier.rb, which  
I do not see in my error, and I do not know how to apply patches to  
Rails.

If anyone could be of assistance I would greatly appreciate it.

I’m using:  
Ruby 1.9.1p243 (2009-07-16 revision 24175)  
Rails 2.3.4  
RubyGems 1.3.5  
MySQLAdmin Ver 8.42 Distrib 5.1.40

---

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 2:00am UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/2 "2009-10-28T02:00:08Z")

</div>

Also, this was what popped out of the terminal:

ActionView::TemplateError (undefined method `^’ for “e”:String) on line  
#3 of app/views/pages/new.html.erb:  
1:

# New page
  
2:  
3: \<% form\_for(@page) do |f| %\>  
4: \<%= f.error\_messages %\>  
5:  
6: 

```
(eval):2:in `form_authenticity_token'
app/views/pages/new.html.erb:3
app/controllers/pages_controller.rb:29:in `new'
<internal:prelude>:8:in `synchronize'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in 

```

start\_thread’

---

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 5:25am UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/3 "2009-10-28T05:25:57Z")

</div>

Hi Joe dude

Firstly advise you to use any name other than page for the resource

> ruby script/generate controller pages home resources about contact  
> ruby script/generate scaffold page name:string title:string body:text  
> rake db:migrate

```
Instead of these do like

```

ruby script/generate scaffold Page name:string title:string body:text  
rake db:migrate  
Now check

```
 And add the additional routes as you go through

```

Sijo K George

---

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 1:09pm UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/4 "2009-10-28T13:09:07Z")

</div>

C K Kashyap wrote:

> Check out this link -  
> [#3144 undefined method `^' for String - RoR 2.3.4 - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234)
> 
> There is a bug in rails 2.3.4 … that throws the same errors you are  
> mentioning.
> 
> –  
> Regards,  
> Kashyap

Well I figured out how to apply this patch by visiting this site –

> <https://stackoverflow.com/questions/930126/how-do-you-apply-a-patch-to-ruby-on-rails>

I’ll try creating a new Rails app and see what happens.

---

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 5:43am UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/5 "2009-10-28T05:43:34Z")

</div>

Check out this link -  
[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)

There is a bug in rails 2.3.4 … that throws the same errors you are  
mentioning.

On Wed, Oct 28, 2009 at 9:55 AM, Sijo k g  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Instead of these do like  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Regards,  
Kashyap

---

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 2:53pm UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/6 "2009-10-28T14:53:03Z")

</div>

Marnen Laibow-Koser wrote:

> You don’t need to create a new app.
> 
> ## Best,
> 
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

It really doesn’t matter since I literally just began toying around with  
RoR. I already deleted the 2 sample apps I generated last night; they  
were hardly touched anyway. No big deal 😛

---

<div class="post-metadata">

**Author:** ![jhosteny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jhosteny](https://www.ruby-forum.com/u/jhosteny)\
**Post date:** [October 28, 2009, 2:07pm UTC](https://www.ruby-forum.com/t/undefined-method-for-e-string/178016/7 "2009-10-28T14:07:25Z")

</div>

Joe dude wrote:

> C K Kashyap wrote:
> 
> > Check out this link -  
> > [#3144 undefined method `^' for String - RoR 2.3.4 - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-method-for-string-ror-234)
> > 
> > There is a bug in rails 2.3.4 … that throws the same errors you are  
> > mentioning.
> > 
> > –  
> > Regards,  
> > Kashyap
> 
> Well I figured out how to apply this patch by visiting this site –  
> [How do you apply a patch to ruby on rails? - Stack Overflow](http://stackoverflow.com/questions/930126/how-do-you-apply-a-patch-to-ruby-on-rails)
> 
> I’ll try creating a new Rails app and see what happens.

You don’t need to create a new app.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
