class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  rescue_from MongoMapper::DocumentNotFound, :with => :error_404

  protected

  def error_404
    render :status => 404, :text => "Not found"
  end
end

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery :with => :null_session

  rescue_from MongoMapper::DocumentNotFound, :with => :error_404

  protected

  def error_404
    render :status => 404, :text => "Not found"
  end
end

Fix request_forgery_protection to work with API requests.
Fix request_forgery_protection to work with API requests.

The default settings raise an error if not given a valid
authenticity_token for all HTML and JSON requests.
