What is InvalidAuthenticityToken?

I create a ruby script to submit a post to my local rails application,
but doesn’t return a data. so I open a log file, saw this.

ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:instart’
/usr/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:instart’
/usr/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/lib/ruby/1.8/webrick/server.rb:92:instart’
/usr/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/lib/ruby/1.8/webrick/server.rb:82:instart’

I want to submit a post, How can I ?

You can use:

http://apidock.com/rails/ActionController/RequestForgeryProtection/form_authenticity_token

To get the value (or use form_for, which automatically handles it).

Cheers,

Andy


Andy J.
http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS
Company number: 5452840