Skip to content

Instantly share code, notes, and snippets.

@javan
Created November 30, 2013 22:06
Show Gist options
  • Select an option

  • Save javan/7725255 to your computer and use it in GitHub Desktop.

Select an option

Save javan/7725255 to your computer and use it in GitHub Desktop.

Revisions

  1. javan created this gist Nov 30, 2013.
    10 changes: 10 additions & 0 deletions application_controller.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    class ApplicationController < ActionController::Base
    before_filter :ensure_xhr

    private
    def ensure_xhr
    if request.get? && request.format && (request.format.js? || request.format.json?)
    head :forbidden unless request.xhr?
    end
    end
    end