wildland/token_authenticate_me

Update render methods to run on 4 and 5

Closed this issue · 1 comments

Users of the lib that are running rails 5

nothing: true part of render status: 204, nothing: true was deprecated in rails 5.1 and removed in 5.2

Instead of
render status: 204, body: nil
use
head 204
for Rails > 5.2

This renders an empty response with status 204.

Action Item:

Update all render methods to use either 5.2 syntax(head 204), if rails > 5.2, or render status: 204, body: nil

        def destroy
          unauthenticate_resource
          
          if Rails::VERSION::STRING < "5.2.0"
               head 204
          else
                render status: 204, body: nil 
          end
        rescue
          render_unauthorized
        end

The solution to this is just to use head 204