Reputation: 13
I followed this guide to implement Dual authentication using Devise and JWT, and when I try to login into my application, I received this error:
undefined local variable or method `request' for SessionsController:Class Did you mean? require
Code of sessions_controller.rb:
class SessionsController < Devise::SessionsController
respond_to :html, :json
clear_respond_to if request.format == 'json'
end
Could someone help me with this error? Thanks.
Upvotes: 0
Views: 201
Reputation: 115511
Try this way:
before_action :trigger_clear_respond_to, if: -> { request.format == 'json' }
def trigger_clear_respond_to
clear_respond_to
end
Upvotes: 3