# Error with flash and form\_authenticity\_token in new rails application with scaffolding

**URL:** <https://www.ruby-forum.com/t/error-with-flash-and-form-authenticity-token-in-new-rails-application-with-scaffolding/176269>\
**Category:** Rails\
**Created:** [September 28, 2009, 9:24am UTC](https://www.ruby-forum.com/t/error-with-flash-and-form-authenticity-token-in-new-rails-application-with-scaffolding/176269 "2009-09-28T09:24:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kashyap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/bbe5ce/32.png) [@kashyap](https://www.ruby-forum.com/u/kashyap)\
**Post date:** [September 28, 2009, 9:24am UTC](https://www.ruby-forum.com/t/error-with-flash-and-form-authenticity-token-in-new-rails-application-with-scaffolding/176269/1 "2009-09-28T09:24:53Z")

</div>

Hi All,  
I get this strange problem with newly scaffolded apps - I’d really  
appreciate any help in this regard.

/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’  
/home/kashyap/Lab/sitara/app/views/resources/new.html.erb:3:in  
`_run_erb_app47views47resources47new46html46erb' /home/kashyap/Lab/sitara/app/controllers/resources_controller.rb:29:in`new’

I bypass this by commenting out protect\_from\_forgery from the  
application\_controller

Another problem I get is with flash -

/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/flash.rb:163:in `flash' /home/kashyap/Lab/sitara/app/controllers/resources_controller.rb:47:in`block in create’  
/home/kashyap/Lab/sitara/app/controllers/resources\_controller.rb:45:in  
`create’

I have to remove the calls to flash from all location for this.

Regards,  
Kashyap

---

<div class="post-metadata">

**Author:** ![kashyap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/bbe5ce/32.png) [@kashyap](https://www.ruby-forum.com/u/kashyap)\
**Post date:** [September 28, 2009, 9:26am UTC](https://www.ruby-forum.com/t/error-with-flash-and-form-authenticity-token-in-new-rails-application-with-scaffolding/176269/2 "2009-09-28T09:26:38Z")

</div>

On Sep 28, 7:22 am, kashyap [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,  
> I get this strange problem with newly scaffolded apps - I’d really  
> appreciate any help in this regard.

Sounds like this bug in 2.3.4:  
[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)

Fred

---

<div class="post-metadata">

**Author:** ![kashyap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/bbe5ce/32.png) [@kashyap](https://www.ruby-forum.com/u/kashyap)\
**Post date:** [September 28, 2009, 9:50am UTC](https://www.ruby-forum.com/t/error-with-flash-and-form-authenticity-token-in-new-rails-application-with-scaffolding/176269/3 "2009-09-28T09:50:38Z")

</div>

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

> On Sep 28, 7:22 am, kashyap [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi All,  
> > I get this strange problem with newly scaffolded apps - I’d really  
> > appreciate any help in this regard.
> 
> Sounds like this bug in 2.3.4:[#3144 undefined method `^' for String - RoR 2.3.4 - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/3144-undefined-)…
> 
> Fred

Thank you very very much … That was exactly the problem … I  
applied the patch and things work just fine!!!  
Regards,  
Kashyap
