Skip to content

Instantly share code, notes, and snippets.

@Amitesh
Created June 14, 2011 09:52
Show Gist options
  • Save Amitesh/1024607 to your computer and use it in GitHub Desktop.
Save Amitesh/1024607 to your computer and use it in GitHub Desktop.
request forgery protection in Rails
# While using curl post call then disable request forgery protection
# For get method call, It skips the check
# Reference : http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html
class XyzController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:update]
before_filter :authenticate_user!, :only => [:update, :index]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment