Recently I was working on a Rails API and I wanted to stop Rails from setting it's _session cookie for API requests.
Since these requests are authenticated via an API token, there's no reason for the cookie to be returned to the user.
# application_controller.rb
after_action lambda {
request.