デバイスセッションコントローラーをオーバーライドしています...動作します(jsonでログインできます)が、エラー時に別のアクションにリダイレクトできません:
class Users::SessionsController < Devise::SessionsController
def create
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#no")
return invalid_login_attempt unless resource
sign_in(resource_name, resource)
#respond_with resource, :location => redirect_location(resource_name, resource)
respond_to do |format|
format.json { render :status => 200, :json => { :success => true, :auth_token => resource.authentication_token, :user => resource } }
end
end
def no
puts "NO!"
return render:json => {:success => false, :errors => alert}
end
end
私も試しました:
if resource.nil?
puts "NIL!"
end
間違ったサインイン資格情報に応答して、常に同じデフォルトの Devise json エラーが発生します。
{error: "You need to sign in or sign up before continuing."}
私は何を間違っていますか?