Rails detect if request was AJAX
You can check for a header[X-Requested-With] to see if it is an AJAX request. Here is a good article on how to do it. Here is an example: if request.xhr? # respond to Ajax request else # respond to normal request end