http://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf
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 Jeffries
http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS
Company number: 5452840
On 2 March 2010 14:21, Zhenning Guan
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
> 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:in `run''
> /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread''
> /usr/lib/ruby/1.8/webrick/server.rb:162:in `start''
> /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread''
> /usr/lib/ruby/1.8/webrick/server.rb:95:in `start''
> /usr/lib/ruby/1.8/webrick/server.rb:92:in `each''
> /usr/lib/ruby/1.8/webrick/server.rb:92:in `start''
> /usr/lib/ruby/1.8/webrick/server.rb:23:in `start''
> /usr/lib/ruby/1.8/webrick/server.rb:82:in `start''
> --
>
> I want to submit a post, How can I ?
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.