Skip to content

Instantly share code, notes, and snippets.

@dgertych-monterail
Created August 21, 2013 10:16
Show Gist options
  • Select an option

  • Save dgertych-monterail/6292747 to your computer and use it in GitHub Desktop.

Select an option

Save dgertych-monterail/6292747 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
# Turn on request forgery protection
protect_from_forgery
after_filter :set_csrf_cookie_for_ng
def set_csrf_cookie_for_ng
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
end
protected
def verified_request?
super || form_authenticity_token == request.headers['X_XSRF_TOKEN']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment