I'd like to set up my Rails controller to only perform a create action if the request has a JavaScript or xml payload. I don't want HTML form submits to trigger a create. Ideally, attempting to do so would send you to an page explaining that you can't do that.
I think one solution would be to put a prepend_before_filter
on the controller that would check the content_type and accept headers of the request.
But is there a cleaner or more common way to achieve this?