Code for context:
module Devise
module Strategies
class AuthxAuthenticatable < Authenticatable
def valid?
!params[scope].nil?
end
def authenticate!
resource = mapping.to.authenticate_with_credentials(params[scope])
return fail(:invalid) if resource.nil?
success!(resource) if validate(resource)
end
end
end
end
Warden::Strategies.add(:authx_authenticatable, Devise::Strategies::AuthxAuthenticatable)
Came across some code where a symbol is passed to raise
:
raise(:invalid)
Doesn't look like there's any monkey patching of raise
to handle symbol arguments. Seems like fail
used to be used, and the code actually works if I use fail
.
Isn't that just an alias for raise
? Does this make sense in any context?