Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
ActionController::InvalidAuthe nticityToken in User#register
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jlhughes  
View profile  
 More options Jul 31 2008, 3:54 pm
From: jlhughes <jlhug...@gmail.com>
Date: Thu, 31 Jul 2008 12:54:27 -0700 (PDT)
Local: Thurs, Jul 31 2008 3:54 pm
Subject: ActionController::InvalidAuthenticityTok en in User#register
I'm new to Ruby and Rails and that's why I'm working my way through
RailsSpace. Unfortunately, I'm trying to use Rails 2.1.0 and ruby
1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

When I get to Chapter 6 and start working in sessions, the
registration form page breaks. I get this error message:

ActionController::InvalidAuthenticityToken in User#register

 Showing user/register.html.erb where line #2 raised:

No :secret given to the #protect_from_forgery call.  Set that or use a
session store capable of generating its own keys (Cookie Session
Store).

Extracted source (around line #2):

1: <h2>Register</h2>
2: <% form_for :user do |form| %>
3:      <fieldset>
4:              <legend>Enter your details</legend>
5:

RAILS_ROOT: /home/www/ruby/rails_space
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
request_forgery_protection.rb:115:in `form_authenticity_token'
(eval):2:in `send'
(eval):2:in `form_authenticity_token'
app/views/user/register.html.erb:2:in
`_run_erb_47app47views47user47register46html46erb'

[snip]

I have tried the errata suggestion: comment out the line with
the :secret key in app/controllers/application.rb.

That change has no effect.

The rake command does not reveal any errors with the test built so
far.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "FIX: ActionController::InvalidAuthe nticityToken in User#register" by jlhughes
jlhughes  
View profile  
 More options Jul 31 2008, 4:22 pm
From: jlhughes <jlhug...@gmail.com>
Date: Thu, 31 Jul 2008 13:22:32 -0700 (PDT)
Local: Thurs, Jul 31 2008 4:22 pm
Subject: FIX: ActionController::InvalidAuthenticityTok en in User#register
The book errata suggests:

This is a known problem in Rails 2. To fix it, comment out the line
with the :secret key in app/controllers/application.rb.

The default app/controllers/application.rb looks like this:

# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => '3e4bba9ec9ada6f82549f43cec63cfe5'

By REMOVING the # before :secret, I am able to get the registration
page to work again.

# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery :secret => '3e4bba9ec9ada6f82549f43cec63cfe5'


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google