Is there any way to find the type of request in controller ?
Yes.
What we do in routes.rb is , define the type of request to particular action .
But What If we want to find out the type of request in controller .
Yes.
What we do in routes.rb is , define the type of request to particular action .
But What If we want to find out the type of request in controller .
if request.get? logger.info "Request is GET" elsif request.post? logger.info "Request is POST" elsif request.xhr? logger.info "Request is AJAX" end