Friday, April 10, 2009

Error: "ActionController::InvalidAuthenticityToken"

Other resources have documented the details of why the error occurs. Rails is preventing a Cross-Site Request Forgery (CSFR). The resources were a little out of sync with my experience. Suspect the difference results from my environment configured with later SW versions.

Resources
Environment
  • jruby -v : jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [x86-java]
  • jruby -S rails -v : Rails 2.3.2
Edit the file app/controllers/application_controller.rb and remove the comment character from the line beginning with "protect_from_forgery :secret => ".

Notes
  • The file name is application_controller.rb, not application.rb, as mentioned in other resources.
  • Added protect_from_forgery :only => [:create, :update, :destroy] to the application_controller.rb file.
I am new to RoR. Misperceptions may be showing through on this topic?

No comments: