```ruby
# For the API
ActionController::Metal.class_eval do
  def spree_current_user
    @spree_current_user ||= env['warden'].user
  end
end
```

Fix `env` deprecated in Rails 5.0
user
```ruby
# For the API
ActionController::Metal.class_eval do
  def spree_current_user
    @spree_current_user ||= request.env['warden'].user
  end
end
```
assistant